[PATCH] 473260 - unmount swap files on upgrades

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The above referenced bug seems to be a really big deal on F10 upgrades.
The problem is that swap files never get unmounted, so the filesystems
they reside on never get unmounted, so migrateFilesystems fails.   The
attached patch corrects this by adding support to just unmount swap
files.  If we come to some sort of agreement on this patch, I'm in favor
of including it in an updates.img.

- Chris


diff --git a/fsset.py b/fsset.py
index a4b3cd4..d425a48 100644
--- a/fsset.py
+++ b/fsset.py
@@ -839,8 +839,19 @@ class swapFileSystem(FileSystemType):
         isys.swapon (device)
 
     def umount(self, device, path):
-        # unfortunately, turning off swap is bad.
-        raise RuntimeError, "unable to turn off swap"
+        # Turning off swap devices is bad, but we can get away with turning
+        # off swap files.
+        if device.device.startswith("/dev/"):
+            raise RuntimeError, "unable to turn off swap"
+
+        # path is something stupid like instPath+"swap", which is totally
+        # useless.  But we don't have instPath anywhere else so trim off
+        # the end of path.
+        swapFile = path[:path.rfind("/")] + device.device
+
+        iutil.execWithRedirect("swapoff", [swapFile],
+                               stdout="/dev/tty5", stderr="/dev/tty5",
+                               searchPath=1)
 
     def formatDevice(self, entry, progress, chroot='/'):
         file = entry.device.setupDevice(chroot)
@@ -2103,7 +2114,10 @@ MAILADDR root
         reverse.reverse()
 
         for entry in reverse:
-            if entry.mountpoint == "swap" and not swapoff:
+            # Always unmount swap files, or we won't be able to unmount the
+            # device they reside on.
+            if entry.mountpoint == "swap" and not swapoff and \
+               entry.device.device.startswith("/dev/"):
                 continue
             entry.umount(instPath)
             entry.device.cleanupDevice(instPath)

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux