summaryrefslogtreecommitdiffstats
path: root/mount/mount.c
diff options
context:
space:
mode:
authorKarel Zak2010-07-20 11:37:23 +0200
committerKarel Zak2010-07-20 11:37:23 +0200
commitaf092544d2b3c8809874251bd5fe05ae6d0e3be2 (patch)
tree33ceb2a41f7a3c5c7af03130a70b09c77268ecec /mount/mount.c
parentcfdisk: get_string not calculating correct limits (diff)
downloadkernel-qcow2-util-linux-af092544d2b3c8809874251bd5fe05ae6d0e3be2.tar.gz
kernel-qcow2-util-linux-af092544d2b3c8809874251bd5fe05ae6d0e3be2.tar.xz
kernel-qcow2-util-linux-af092544d2b3c8809874251bd5fe05ae6d0e3be2.zip
mount: don't use auto-clear loopdev if mtab is available
# mount /home/images/floppy.img /mnt/test2 # mount | grep loop /dev/loop0 on /mnt/test2 type udf (rw) mount(8) with auto-clear loopdev does not store information about the original backing file (the image) to /etc/mtab. (Note that this is our long-term goal, because we want to remove mtab from Linux.) Unfortunately, losetup(8) is not able to provide full path for the backing file, because LOOP_GET_STATUS ioctl uses 64 bytes for the filename... So, without the information about the backing file in mtab the information about mapping between the file and the loopdev is unaccessible from userspace. From my point of view it would be nice to add all necessary information about loopdevs to /sys rather than rely on broken LOOP_GET_STATUS[64] ioctls. with this patch: # mount /home/images/floppy.img /mnt/test2 # mount | grep loop# mount | grep loop /home/images/floppy.img on /mnt/test2 type udf (ro,loop=/dev/loop0) Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=615389 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount/mount.c')
-rw-r--r--mount/mount.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mount/mount.c b/mount/mount.c
index b2e445a45..fef1a852c 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -1141,7 +1141,8 @@ loop_check(const char **spec, const char **type, int *flags,
if (verbose)
printf(_("mount: skipping the setup of a loop device\n"));
} else {
- int loop_opts = SETLOOP_AUTOCLEAR; /* always attempt autoclear */
+ /* use autoclear loopdev on system without regular mtab only */
+ int loop_opts = mtab_is_writable() ? 0 : SETLOOP_AUTOCLEAR;
int res;
if (*flags & MS_RDONLY)