[prev in list] [next in list] [prev in thread] [next in thread] 

List:       libguestfs
Subject:    [Libguestfs] [PATCH] sysprep: Try unmounting the filesystem a few times when busy.
From:       "Richard W.M. Jones" <rjones () redhat ! com>
Date:       2012-02-15 19:31:44
Message-ID: 1329334304-11930-1-git-send-email-rjones () redhat ! com
[Download RAW message or body]

From: "Richard W.M. Jones" <rjones@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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic