[systemd-commits] 2 commits - TODO src/fsck src/udev

Kay Sievers kay at kemper.freedesktop.org
Wed Jun 4 02:16:46 PDT 2014


 TODO             |    4 +++-
 src/fsck/fsck.c  |   13 ++++++++++++-
 src/udev/udevd.c |   45 ++++++++++++++++++++++-----------------------
 3 files changed, 37 insertions(+), 25 deletions(-)

New commits:
commit c343be283b7152554bac0c02493a4e1759c163f7
Author: Kay Sievers <kay at vrfy.org>
Date:   Wed Jun 4 11:14:48 2014 +0200

    fsck: disable "-l" option for now
    
      https://bugs.freedesktop.org/show_bug.cgi?id=79576#c5

diff --git a/TODO b/TODO
index 8169a57..fb118f1 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,7 @@
 Bugfixes:
+* Re-enable "fsck -l" when it is ready:
+   https://bugs.freedesktop.org/show_bug.cgi?id=79576#c5
+
 * Should systemctl status \* work on all unit types, not just .service?
 
 * enabling an instance unit creates a pointless link, and
@@ -20,7 +23,6 @@ Bugfixes:
   See the comment in sd_bus_unref() for more..
 
 External:
-
 * Fedora: when installing fedora with yum --installroot /var/run is a directory, not a symlink
    https://bugzilla.redhat.com/show_bug.cgi?id=975864
 
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index 56cb52d..cb2f573 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -319,7 +319,18 @@ int main(int argc, char *argv[]) {
         cmdline[i++] = "/sbin/fsck";
         cmdline[i++] =  arg_repair;
         cmdline[i++] = "-T";
-        cmdline[i++] = "-l";
+
+        /*
+         * Disable locking which conflict with udev's event
+         * ownershipi, until util-linux moves the flock
+         * synchronization file which prevents multiple fsck running
+         * on the same rotationg media, from the disk device
+         * node to a privately owned regular file.
+         *
+         * https://bugs.freedesktop.org/show_bug.cgi?id=79576#c5
+         *
+         * cmdline[i++] = "-l";
+         */
 
         if (!root_directory)
                 cmdline[i++] = "-M";

commit edd32000c806e4527c5f376d138f7bff07724c26
Author: Kay Sievers <kay at vrfy.org>
Date:   Wed Jun 4 11:05:45 2014 +0200

    udevd: inotify - modernizations

diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 6c05104..59b5568 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -733,20 +733,30 @@ out:
         return udev_ctrl_connection_unref(ctrl_conn);
 }
 
+static void synthesize_change(struct udev_device *dev) {
+        char filename[UTIL_PATH_SIZE];
+
+        log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev));
+        strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL);
+        write_string_file(filename, "change");
+}
+
 /* read inotify messages */
 static int handle_inotify(struct udev *udev)
 {
         int nbytes, pos;
         char *buf;
         struct inotify_event *ev;
+        int r;
 
-        if ((ioctl(fd_inotify, FIONREAD, &nbytes) < 0) || (nbytes <= 0))
-                return 0;
+        r = ioctl(fd_inotify, FIONREAD, &nbytes);
+        if (r < 0 || nbytes <= 0)
+                return -errno;
 
         buf = malloc(nbytes);
-        if (buf == NULL) {
+        if (!buf) {
                 log_error("error getting buffer for inotify");
-                return -1;
+                return -ENOMEM;
         }
 
         nbytes = read(fd_inotify, buf, nbytes);
@@ -756,27 +766,16 @@ static int handle_inotify(struct udev *udev)
 
                 ev = (struct inotify_event *)(buf + pos);
                 dev = udev_watch_lookup(udev, ev->wd);
-                if (dev != NULL) {
-                        log_debug("inotify event: %x for %s", ev->mask, udev_device_get_devnode(dev));
-                        if (ev->mask & IN_CLOSE_WRITE) {
-                                char filename[UTIL_PATH_SIZE];
-                                int fd;
-
-                                log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev));
-                                strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL);
-                                fd = open(filename, O_WRONLY|O_CLOEXEC);
-                                if (fd >= 0) {
-                                        if (write(fd, "change", 6) < 0)
-                                                log_debug("error writing uevent: %m");
-                                        close(fd);
-                                }
-                        }
-                        if (ev->mask & IN_IGNORED)
-                                udev_watch_end(udev, dev);
+                if (!dev)
+                        continue;
 
-                        udev_device_unref(dev);
-                }
+                log_debug("inotify event: %x for %s", ev->mask, udev_device_get_devnode(dev));
+                if (ev->mask & IN_CLOSE_WRITE)
+                        synthesize_change(dev);
+                else if (ev->mask & IN_IGNORED)
+                        udev_watch_end(udev, dev);
 
+                udev_device_unref(dev);
         }
 
         free(buf);



More information about the systemd-commits mailing list