umount --detach-loop fails but fs is unmounted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
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




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux