Util-Linux package development
 help / color / mirror / Atom feed
* 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

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