[Libguestfs] [PATCH] sysprep: Try unmounting the filesystem a few times when busy.

Richard W.M. Jones rjones at redhat.com
Wed Feb 15 19:31:44 UTC 2012


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

tracker-miner-fs jumps into newly mounted filesystems.  This prevents
the filesystem from being unmounted, so retry a few times.
---
 clone/virt-sysprep.in |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/clone/virt-sysprep.in b/clone/virt-sysprep.in
index 9e8f212..833a31d 100644
--- a/clone/virt-sysprep.in
+++ b/clone/virt-sysprep.in
@@ -390,7 +390,17 @@ esac
 
 sync
 
-fusermount -u $tmpdir/mnt
+# Unfortunately various unwanted processes jump into mountpoints.
+# tracker-miner-fs is the latest, previously it was something called
+# gvfs-gdu-volume-monitor.  Therefore if the mountpoint is busy, try
+# to unmount it a few times.  XXX
+count=10
+while ! fusermount -u $tmpdir/mnt && [ $count -gt 0 ]; do
+    sleep 1
+    ((count--))
+done
+if [ $count -eq 0 ]; then exit 1; fi
+
 rm -rf $tmpdir
 
 trap - EXIT ERR
-- 
1.7.9




More information about the Libguestfs mailing list