[Libguestfs] [PATCH] fuse: Add guestmount-cleanup program to handle unmounting (RHBZ#916780).

Richard W.M. Jones rjones at redhat.com
Mon Mar 4 21:30:29 UTC 2013


* PATCH FOR DISCUSSION ONLY - NOT TO BE APPLIED *

Colin suggested something which seems eminently sensible:
https://bugzilla.redhat.com/show_bug.cgi?id=916780

I've been through a couple of rounds of trying to implement this.

I started with adding the option as suggested to the guestmount
program, but it tended to make the guestmount program more complex.
More importantly, adding the option only to guestmount means that it
cannot be used outside guestmount, specifically by programs that use
the mount-local API[1] directly.  (For various reasons
'guestfs_umount_local' isn't a usable API in most situations).

My second implementation is the patch attached.  It adds a new program
called guestmount-cleanup which can be used two ways:

 guestmount-cleanup --fd=<FD> mountpoint

where it will monitor the pipe file descriptor <FD>.  (I should note
that I've never actually tested this code path).

Or:

 guestmount-cleanup mountpoint

where it immediately unmounts the mountpoint.  In both cases it deals
with fusermount retries.

The patch is still large and clunky and it doesn't make FUSE that much
easier to cope with.

I suspect the way to go from here is to reimplement fusermount itself.
It would, for example, be much better if we could get some information
from fusermount about why it failed.  That seems like a good idea
until I tell you that fusermount is a setuid program and needs those
privs even when dealing with a regular non-root FUSE mount.  So we
pretty much have to use it, so I'll have to send patches for it.

It may also be that we're going about this all wrong and we should use
CLONE_NS (which also requires root -- currently) to stop these
systemwide daemons from interfering.

Rich.

[1] http://libguestfs.org/guestfs.3.html#mount-local




More information about the Libguestfs mailing list