[systemd-devel] [PATCH] udev: don't create symlink or rename if it already exists
kay at vrfy.org
Tue Feb 12 05:57:28 PST 2013
On Tue, Feb 12, 2013 at 2:18 PM, Robert Milasan <rmilasan at suse.com> wrote:
> Under some circumstances udev mixed with multipath fails:
> symlink(../../sdk, /dev/disk/by-id/scsi-36005076305ffc0670000000000002842.udev-tmp)
> failed: File exists udevd-work:
> rename(/dev/disk/by-id/scsi-36005076305ffc0850000000000000a88.udev-tmp, /dev/disk/by-id/scsi-36005076305ffc0850000000000000a88)
> failed: No such file or directory
> This is non-fatal, but there is no point of created the symlink or
> renaming the symlink if it already exists.
> Reference: https://bugzilla.novell.com/show_bug.cgi?id=791503
There is always a window between the check and the action, this patch
makes it only smaller, but it can still happen.
We have to accept some of the races in hotplug setups and devices
fighting about the same resources/names, some of these problems cannot
be easily solved, but in this case it is a race for a name we created
on our own, and which can be fixed without leaving any race window
We should probably include the device dev_t (like
udev_device_get_id_filename()) or worker PID or something else in the
temporary name to make it unique, or just don't print an error when
the temporary file is gone before the renaming.
Adding racy checks for an existing temp file name does not seem like
the right thing to do.
Btw, you should use a different mailer for sending patches, or attach
them; this seems all mangled and would not apply.
More information about the systemd-devel