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
udev-node: use flock() for symlink stack directory #23043
Conversation
c3d23a8
to
2c48e52
Compare
2c48e52
to
2267c38
Compare
@poettering Thank you for the review. Most of comments are addressed. PTAL. |
2267c38
to
1a340d6
Compare
@poettering Thank you for the review. The commit message and the comment in the code is updated. Also, the cleanup logic is updated. PTAL. |
1a340d6
to
02952ad
Compare
I kinda like the idea, but how to handle upgrades then? |
Maybe we should just tell people to retrigger everything on update. Which they really should do anyway. If so, then the old dir just doesn't matter (though we wouldn't clean it up either, but I'd be OK with that) |
So I thought about this approach, and I think we should implement this, but this doesn't solve the problem fully, because if you want to create a temporary path for something that has NAME_MAX length already, and the last compononent (i.e. the filename) is just one character, then you cannot possibly stick six XXXXXX characters in there anymore. So while it pushes the problem out, it doesn't solve it... |
Can you give an example? I don't understand the comment. |
No functionality is changed.
No functionality is changed.
Then, we can always assume the directory exists, and the code become slightly simpler. Note, unused directories are removed by the main udevd process in a later commit.
And try to read it only when the file is symlink.
Also shorten code a bit. Just for consistency with other part and readability of the code.
By locking the stack directory, we can safely determine the device node with the highest priority for a symlink. So, the multiple try-and-wait loops can be dropped, and the code becomes quite simple.
By the previous commit, the stack directories are not removed even if it is empty. To reduce the inode usage of /run, let's cleanup the directories.
4cdeb8b
to
1055172
Compare
@poettering Thank you for the review. All comments are addressed. PTAL. @fbuihuu Sorry for late response again.
Hm, yeah, the file is created with 0600. There is no problem.
Not sure, maybe. If so, we can rewrite with it. But let's do that later. |
If the filename of a device symlink is too long, then the temporary filename may become invalid, and we fail to create symlink. The function `tempfn_random()` used in symlink_atomic_full() generates a safe temporary filename. Note that, thanks to the PR systemd#23043, now only one worker can handle the same symlink simultaneously. Hence, the device ID based temporary filename is not necessary.
If the filename of a device symlink is too long, then the temporary filename may become invalid, and we fail to create symlink. The function `tempfn_random()` used in symlink_atomic_full() generates a safe temporary filename. Note that, thanks to the PR systemd#23043, now only one worker can handle the same symlink simultaneously. Hence, the device ID based temporary filename is not necessary.
If the filename of a device symlink is too long, then the temporary filename may become invalid, and we fail to create symlink. The function `tempfn_random()` used in symlink_atomic_full() generates a safe temporary filename. Note that, thanks to the PR systemd#23043, now only one worker can handle the same symlink simultaneously. Hence, the device ID based temporary filename is not necessary.
If the filename of a device symlink is too long, then the temporary filename may become invalid, and we fail to create symlink. The function `tempfn_random()` used in symlink_atomic_full() generates a safe temporary filename. Note that, thanks to the PR systemd#23043, now only one worker can handle the same symlink simultaneously. Hence, the device ID based temporary filename is not necessary.
If the filename of a device symlink is too long, then the temporary filename may become invalid, and we fail to create symlink. The function `tempfn_random()` used in symlink_atomic_full() generates a safe temporary filename. Note that, thanks to the PR systemd#23043, now only one worker can handle the same symlink simultaneously. Hence, the device ID based temporary filename is not necessary.
If the filename of a device symlink is too long, then the temporary filename may become invalid, and we fail to create symlink. The function `tempfn_random()` used in symlink_atomic_full() generates a safe temporary filename. Note that, thanks to the PR systemd#23043, now only one worker can handle the same symlink simultaneously. Hence, the device ID based temporary filename is not necessary.
If the filename of a device symlink is too long, then the temporary filename may become invalid, and we fail to create symlink. The function `tempfn_random()` used in symlink_atomic_full() generates a safe temporary filename. Note that, thanks to the PR systemd#23043, now only one worker can handle the same symlink simultaneously. Hence, the device ID based temporary filename is not necessary.
If the filename of a device symlink is too long, then the temporary filename may become invalid, and we fail to create symlink. The function `tempfn_random()` used in symlink_atomic_full() generates a safe temporary filename. Note that, thanks to the PR systemd#23043, now only one worker can handle the same symlink simultaneously. Hence, the device ID based temporary filename is not necessary.
If the filename of a device symlink is too long, then the temporary filename may become invalid, and we fail to create symlink. The function `tempfn_random()` used in symlink_atomic_full() generates a safe temporary filename. Note that, thanks to the PR systemd#23043, now only one worker can handle the same symlink simultaneously. Hence, the device ID based temporary filename is not necessary.
If the filename of a device symlink is too long, then the temporary filename may become invalid, and we fail to create symlink. The function `tempfn_random()` used in symlink_atomic_full() generates a safe temporary filename. Note that, thanks to the PR systemd#23043, now only one worker can handle the same symlink simultaneously. Hence, the device ID based temporary filename is not necessary.
No description provided.