[Libguestfs] [PATCH 1/4] fuse: Document race condition possible with fusermount.

Richard W.M. Jones rjones at redhat.com
Mon Jul 9 15:13:24 UTC 2012


From: "Richard W.M. Jones" <rjones at redhat.com>

See also:
https://bugzilla.redhat.com/show_bug.cgi?id=835466#c9
---
 fuse/guestmount.pod |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/fuse/guestmount.pod b/fuse/guestmount.pod
index a0bc6f1..c37301c 100644
--- a/fuse/guestmount.pod
+++ b/fuse/guestmount.pod
@@ -106,6 +106,22 @@ namespace using the Linux-specific L<clone(2)>/L<unshare(2)> flag
 C<CLONE_NEWNS>.  Unfortunately at the moment this requires root and we
 would also probably need to add it as a feature to guestmount.
 
+=head2 Race conditions possible when shutting down the connection
+
+When C<fusermount -u> exits, guestmount may still be running and
+cleaning up the mountpoint.  The disk image will not be fully
+finalized.
+
+This means that scripts like the following have a nasty race
+condition:
+
+ guestmount -a disk.img -i /mnt
+ # copy things into /mnt
+ fusermount -u /mnt
+ # immediately try to use 'disk.img' <-- UNSAFE
+
+The solution is to spin waiting for the guestmount process to exit.
+
 =head1 OPTIONS
 
 =over 4
-- 
1.7.10.4




More information about the Libguestfs mailing list