Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rasdaemon: Can't open trace_clock #74

Open
Martins3 opened this issue Nov 2, 2022 · 0 comments
Open

rasdaemon: Can't open trace_clock #74

Martins3 opened this issue Nov 2, 2022 · 0 comments

Comments

@Martins3
Copy link

Martins3 commented Nov 2, 2022

What's happening

sometimes, systemd failed to bootstrap rasdasmon, the log looks like this:

rasdaemon: Can't open trace_clock
rasdaemon: Can't select a timestamp for tracing

Root Cause

systemd will start two rasdaemon process with different arguments, both of them share a common code path

  1. firstly, create /sys/kernel/debug/tracing/instances/rasdaemon
    rc = mkdir(ras->tracing, S_IRWXU);
  2. then, open /sys/kernel/debug/tracing/instances/rasdaemon/trace_clock
    fd = open_trace(ras, "trace_clock", O_RDONLY);

If the first process is creating the /sys/kernel/debug/tracing/instances/rasdaemon, then the second process's mkdir will fail at the kernel code path vfs_mkdir, then the second one try to open trace_clock, but the first one doesn't create it yet.

mkdir and populating the contents in the directory is the not atomic.

Possible solution

  1. use file lock to guard the mkdir operation
  2. change kernel code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant