]>
git.ipfire.org Git - thirdparty/util-linux.git/commit
losetup: cleanup device node modes
The current code follows ro/rw mode not only set mode of the new
device, but also to open the device node for ioctls.
Linux kernel does not care and it seems O_RDONLY is good enough
for all cases (ioctls).
Unfortunately, udevd is sensitive as it monitors devices by inotify
and IN_CLOSE_WRITE event is expected to apply udev rules for the
device.
Changes:
* remove LOOPDEV_FL_{RDONLY,RDWR} private flags, it's too complex and
unnecessary
* use mode_t for open() modes (rater than int)
* re-open only if O_RDWR requested otherwise default to O_RDONLY
* make sure O_RDWR is used on device setup
Fixes: https://github.com/util-linux/util-linux/issues/2434
Signed-off-by: Karel Zak <kzak@redhat.com>