* umount --detach-loop fails but fs is unmounted
@ 2015-03-27 19:03 Alex Deymo
2015-04-03 10:06 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Alex Deymo @ 2015-03-27 19:03 UTC (permalink / raw)
To: util-linux
Hi,
I'm running into a problem when using -d in umount. I'm using
util-linux 2.25.1, but didn't see changes in that code in ToT. When
calling "umount -d" if the passed argument is *not* a loop device (for
example /dev/loopX or /mnt/foo/bar), it will umount it, but the
command will fail (return != 0) and print EINVAL error (22).
Documentation says:
-d, --detach-loop
When the unmounted device was a loop device, also free this loop device.
So the command shouldn't fail if you didn't pass a loop device but
still used -d; right? Is this a problem in the documentation or the
code?
* Examples: if you mount your ${image} (an ext4 fs, but whatever) in
${mount_point} this way:
loop_device=$(sudo losetup --find --show ${image})
sudo mount -o rw ${loop_device} ${mount_point}
The following command fails (error code 1) and does NOT remove the
loop device, but unmounts the fs properly:
sudo umount -d ${mount_point}
umount: ${mount_point}: filesystem was unmounted, but mount(8) failed:
Invalid argument
On the other hand, if you run this command instead, it succeeds and
removes the loop device:
sudo umount -d ${loop_device}
If your loop device has AUTOCLEAN=1 (see "losetup --list --all") the
loop device is removed either way, but the command still fails when
using ${mount_point}:
sudo mount -o loop,rw ${image} ${mount_point}
This command fails but loop is removed due to the autoclean.
sudo umount -d ${mount_point}
Thanks,
deymo.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: umount --detach-loop fails but fs is unmounted
2015-03-27 19:03 umount --detach-loop fails but fs is unmounted Alex Deymo
@ 2015-04-03 10:06 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2015-04-03 10:06 UTC (permalink / raw)
To: Alex Deymo; +Cc: util-linux
On Fri, Mar 27, 2015 at 12:03:26PM -0700, Alex Deymo wrote:
> I'm running into a problem when using -d in umount. I'm using
> util-linux 2.25.1, but didn't see changes in that code in ToT. When
> calling "umount -d" if the passed argument is *not* a loop device (for
> example /dev/loopX or /mnt/foo/bar), it will umount it, but the
> command will fail (return != 0) and print EINVAL error (22).
> Documentation says:
>
> -d, --detach-loop
> When the unmounted device was a loop device, also free this loop device.
>
> So the command shouldn't fail if you didn't pass a loop device but
> still used -d; right? Is this a problem in the documentation or the
> code?
>
> * Examples: if you mount your ${image} (an ext4 fs, but whatever) in
> ${mount_point} this way:
>
> loop_device=$(sudo losetup --find --show ${image})
> sudo mount -o rw ${loop_device} ${mount_point}
>
>
> The following command fails (error code 1) and does NOT remove the
> loop device, but unmounts the fs properly:
> sudo umount -d ${mount_point}
> umount: ${mount_point}: filesystem was unmounted, but mount(8) failed:
> Invalid argument
I'm not able to reproduce this problem.
# rpm -q util-linux
util-linux-2.25.2-2.fc21.x86_64
# losetup --find --show /home/archive/fs-images/filesystems/ext2.img
/dev/loop0
# mount /dev/loop0 /mnt/test
# losetup
NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE
/dev/loop0 0 0 0 0 /home/archive/fs-images/filesystems/ext2.img
# findmnt /mnt/test
TARGET SOURCE FSTYPE OPTIONS
/mnt/test /dev/loop0 ext3 rw,relatime,seclabel,data=ordered
# umount -d /mnt/test
# echo $?
0
Please, try
LIBMOUNT_DEBUG=0xffff umount -d ${mount_point}
or/and strace output would be also nice.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-03 10:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-27 19:03 umount --detach-loop fails but fs is unmounted Alex Deymo
2015-04-03 10:06 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox