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@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html