]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/loopdev: clarify comment about device and backing file modes
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>
Wed, 16 Apr 2025 09:53:36 +0000 (11:53 +0200)
committerThomas Weißschuh <thomas.weissschuh@linutronix.de>
Wed, 16 Apr 2025 09:53:36 +0000 (11:53 +0200)
If either the backing file or ioctl loop device are opened read-only the
kernel will silently downgrade the resulting loop device to read-only.

Adapt the comment to this.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
lib/loopdev.c

index 11bbc1869a01c312421cae71cfde82dd387fb0e6..f2931552c665c374245a660a472c489c1ab7b116 100644 (file)
@@ -1418,12 +1418,9 @@ int loopcxt_setup_device(struct loopdev_cxt *lc)
        do {
                errno = 0;
 
-               /* For the ioctls, it's enough to use O_RDONLY, but udevd
-                * monitor devices by inotify, and udevd needs IN_CLOSE_WRITE
-                * event to trigger probing of the new device.
-                *
-                * The mode used for the device does not have to match the mode
-                * used for the backing file.
+               /* For the ioctls, it's enough to use O_RDONLY for a read-only
+                * loop device, but udevd monitor devices by inotify, and udevd
+                * needs IN_CLOSE_WRITE event to trigger probing of the new device.
                 */
                dev_fd = __loopcxt_get_fd(lc, O_RDWR);
                if (dev_fd >= 0 || lc->control_ok == 0)