cryptsetup-generator: avoid ordering cycle on swap
authorTom Gundersen <teg@jklm.no>
Mon, 17 Oct 2011 11:01:08 +0000 (13:01 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 1 Nov 2011 22:42:41 +0000 (23:42 +0100)
Devices with random keys (swap), should not be ordered before local-fs.target,
as this creates a cycle with systemd-load-random-seed.service (and also it
does not make sense, a swap device is not a local-fs).

src/cryptsetup-generator.c

index 6f3aa78..a48b7a4 100644 (file)
@@ -112,8 +112,7 @@ static int create_disk(
                 "DefaultDependencies=no\n"
                 "BindTo=%s dev-mapper-%%i.device\n"
                 "After=systemd-readahead-collect.service systemd-readahead-replay.service %s\n"
-                "Before=umount.target\n"
-                "Before=local-fs.target\n",
+                "Before=umount.target\n",
                 d, d);
 
         if (!nofail)
@@ -125,6 +124,9 @@ static int create_disk(
                          streq(password, "/dev/hw_random")))
                 fprintf(f,
                         "After=systemd-random-seed-load.service\n");
+        else
+                fprintf(f,
+                        "Before=local-fs.target\n");
 
         fprintf(f,
                 "\n[Service]\n"