[systemd-commits] src/special.h src/swap.c

Lennart Poettering lennart at kemper.freedesktop.org
Mon Nov 22 12:07:24 PST 2010


 src/special.h |    1 +
 src/swap.c    |   12 +++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit cfcfd4aefe2141d324f51033057674d9f1171ef3
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Nov 22 21:06:38 2010 +0100

    swap: order file-based swap devices after remount-rootfs

diff --git a/src/special.h b/src/special.h
index efd792d..df1e1fa 100644
--- a/src/special.h
+++ b/src/special.h
@@ -65,6 +65,7 @@
 #define SPECIAL_DBUS_SOCKET "dbus.socket"
 #define SPECIAL_GETTY_TARGET "getty.target"
 #define SPECIAL_SERIAL_GETTY_SERVICE "serial-getty at .service"
+#define SPECIAL_REMOUNT_ROOTFS_SERVICE "remount-rootfs.service"
 
 #ifndef SPECIAL_SYSLOG_SERVICE
 #define SPECIAL_SYSLOG_SERVICE "syslog.service"
diff --git a/src/swap.c b/src/swap.c
index ec9f157..0d3cb2f 100644
--- a/src/swap.c
+++ b/src/swap.c
@@ -199,9 +199,15 @@ static int swap_add_device_links(Swap *s) {
         else
                 return 0;
 
-        return unit_add_node_link(UNIT(s), s->what,
-                                  !p->noauto && p->nofail &&
-                                  s->meta.manager->running_as == MANAGER_SYSTEM);
+        if (is_device_path(s->what))
+                return unit_add_node_link(UNIT(s), s->what,
+                                          !p->noauto && p->nofail &&
+                                          s->meta.manager->running_as == MANAGER_SYSTEM);
+        else
+                /* File based swap devices need to be ordered after
+                 * remount-rootfs.service, since they might need a
+                 * writable file system. */
+                return unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, SPECIAL_REMOUNT_ROOTFS_SERVICE, NULL, true);
 }
 
 static int swap_add_default_dependencies(Swap *s) {



More information about the systemd-commits mailing list