]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lib/loopdev: open loop control device read-only if possible
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>
Wed, 16 Apr 2025 09:55:31 +0000 (11:55 +0200)
committerThomas Weißschuh <thomas.weissschuh@linutronix.de>
Wed, 16 Apr 2025 09:55:31 +0000 (11:55 +0200)
commit47ed406f8594fcbcfe12727c6ade4579658a485e
tree64e4a91fd1aaa1446d2e738e63915ffba3697d9f
parentc6fc8252299fd4a8b1b02f936ac9dcc7521bd595
lib/loopdev: open loop control device read-only if possible

Opening the control device read-write to trigger udev events is a hack.
It works around a kernel bug which fails to send uevents directly from the
kernel by triggering a full udev reprobe.
While it works to trigger the events, it is problematic.
The udev reprobe will asynchronously recreate all partition devices which
requires an ungly locking and synchronization scheme after losetup has
completed to guarantee the usability of the partition devices.

The kernel has been fixed to properly emit these uevents in
commit 7ed2a771b5fb ("loop: properly send KOBJ_CHANGED uevent for disk device").

Drop the workaround.

This is a partial revert of
commit ced1142d6f25 ("losetup: cleanup device node modes").

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