[Libguestfs] guestunmount issues

Pino Toscano ptoscano at redhat.com
Mon Nov 23 16:59:03 UTC 2015


Hi,

On Monday 23 November 2015 18:29:50 Maxim Perevedentsev wrote:
> 1) guestunmount never returns 3 (not mounted) - i guess it's a bug at 
> guestunmount.c:223

Indeed, thanks for the notice -- just send a patch for it.

> 2) I don't know whether it's a bug in guestunmount or fusermount, but on 
> my machine while executing
>  > guestmount
>  > guestunmount
>  > guestunmount
> on second "guestunmount" I get
> "guestunmount: failed to unmount {...}: fusermount: failed to unmount 
> {...}: Invalid argument"
> while, according to guestunmount.c, guestunmount should return something 
> like
> "entry for {} not found"

Most probably it has to do with the (3) below: fusermount just reports
the EINVAL got from umount while trying to unmount an not-mounted
directory.

> 3)
>  > fusermount -u {}
> gives me "Invalid argument" as well, while
>  > umount {}
> handles this error successfully and returns "not mounted".
> (strace logs attached)

Well, umount still returns 1, so 

In any case, both fail due to the mount point not being actually
mounted; the difference is that umount takes the EINVAL from umount2
(which calls the umount Linux syscall) as an indication the directory
is not a mount point, while fusermount just reports the failure as it
is.

> I'd like someone to compare results with mine, and, possibly, give me 
> some explanations about why it's going like this and how to distinguish 
> non-mounted mountpoints from busy ones (I guess I'll have to parse 
> umount {} output).

Unfortunately it does not seem to be possible to do that, just by
checking the return values of the tools. I guess you might want to ask
fuse and util-linux people to improve the return values, although that
might break user code...
Another alternative may be writing C code doing the umount, but that
would imply rewrite part of the logic...

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20151123/a5132c26/attachment.sig>


More information about the Libguestfs mailing list