imgcreate/fs.py |   23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 118092c8a2878eb2dfc5ea3eed7298bc18541a03
Author: Bruno Wolff III <[email protected]>
Date:   Sat Sep 11 11:44:11 2010 -0500

    Try normal umount before falling back to lazy umount.
    
    We want to log when lazy umounts are needed, so that we can try to change
    whatever is requiring them in the first place, to not do that.

diff --git a/imgcreate/fs.py b/imgcreate/fs.py
index 554d1b9..c8df085 100644
--- a/imgcreate/fs.py
+++ b/imgcreate/fs.py
@@ -112,9 +112,16 @@ class BindChrootMount:
         if not self.mounted:
             return
 
-        rc = subprocess.call(["/bin/umount", "-l", self.dest])
+        rc = subprocess.call(["/bin/umount", self.dest])
         if rc != 0:
-            raise MountError("Unable to unmount filesystem at %s" % self.dest)
+            logging.debug("Unable to unmount %s normally, using lazy unmount" 
% self.dest)
+            rc = subprocess.call(["/bin/umount", "-l", self.dest])
+            if rc != 0:
+                raise MountError("Unable to unmount fs at %s" % self.dest)
+            else:
+                logging.debug("lazy umount succeeded on %s" % self.dest)
+                print >> sys.stdout, "lazy umount succeeded on %s" % self.dest
+ 
         self.mounted = False
 
 class LoopbackMount:
@@ -353,11 +360,19 @@ class DiskMount(Mount):
     def unmount(self):
         if self.mounted:
             logging.debug("Unmounting directory %s" % self.mountdir)
-            rc = subprocess.call(["/bin/umount", "-l", self.mountdir])
+            rc = subprocess.call(["/bin/umount", self.mountdir])
             if rc == 0:
                 self.mounted = False
             else:
-                raise MountError("Unable to unmount filesystem at %s" % 
self.mountdir)
+                logging.debug("Unmounting directory %s failed, using lazy 
umount" % self.mountdir)
+                print >> sys.stdout, "Unmounting directory %s failed, using 
lazy umount" %self.mountdir
+                rc = subprocess.call(["/bin/umount", "-l", self.mountdir])
+                if rc != 0:
+                    raise MountError("Unable to unmount filesystem at %s" % 
self.mountdir)
+                else:
+                    logging.debug("lazy umount succeeded on %s" % 
self.mountdir)
+                    print >> sys.stdout, "lazy umount succeeded on %s" % 
self.mountdir
+                    self.mounted = False
 
         if self.rmdir and not self.mounted:
             try:


--
livecd mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/livecd

Reply via email to