[systemd-commits] src/udev

Kay Sievers kay at kemper.freedesktop.org
Wed Jun 4 07:28:18 PDT 2014


 src/udev/udevd.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 02ba8fb3357daf57f6120ac512fb464a4c623419
Author: Kay Sievers <kay at vrfy.org>
Date:   Wed Jun 4 16:21:19 2014 +0200

    udev: guard REREADPT by exclusive lock instead of O_EXCL

diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 81e3f69..0f3f3f0 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -755,9 +755,12 @@ static int synthesize_change(struct udev_device *dev) {
                  * partition table is found, and we will not get an event for
                  * the disk.
                  */
-                fd = open(udev_device_get_devnode(dev), O_RDONLY|O_EXCL|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK);
+                fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK);
                 if (fd >= 0) {
-                        r = ioctl(fd, BLKRRPART, 0);
+                        r = flock(fd, LOCK_EX|LOCK_NB);
+                        if (r >= 0)
+                                r = ioctl(fd, BLKRRPART, 0);
+
                         close(fd);
                         if (r >= 0)
                                 part_table_read = true;



More information about the systemd-commits mailing list