[systemd-devel] [PATCH] fstab-generator: handle mount units with "x-rootfs.mount"

harald at redhat.com harald at redhat.com
Thu Mar 14 05:15:09 PDT 2013


From: Harald Hoyer <harald at redhat.com>

Mount units with "x-rootfs.mount" are now ordered before root-fs.target.
As we sometimes construct /sysroot mounts in /etc/fstab in the initrd,
we want these to be mounted before the root-fs.target is active.
---
 src/fstab-generator/fstab-generator.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index b4fb134..6905316 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -199,6 +199,13 @@ static bool mount_in_initrd(struct mntent *me) {
                 streq(me->mnt_dir, "/usr");
 }
 
+static bool mount_is_rootfs(struct mntent *me) {
+        assert(me);
+
+        return
+                hasmntopt(me, "x-rootfs.mount");
+}
+
 static int add_mount(const char *what, const char *where, const char *type, const char *opts,
                      int passno, bool noauto, bool nofail, bool automount, bool isbind,
                      const char *pre, const char *post, const char *source) {
@@ -434,6 +441,9 @@ static int parse_fstab(const char *prefix, bool initrd) {
                         if (initrd) {
                                 post = SPECIAL_INITRD_FS_TARGET;
                                 pre = NULL;
+                        } else if (mount_is_rootfs(me)) {
+                                post = SPECIAL_ROOT_FS_TARGET;
+                                pre = NULL;
                         } else if (mount_is_network(me)) {
                                 post = SPECIAL_REMOTE_FS_TARGET;
                                 pre = SPECIAL_REMOTE_FS_PRE_TARGET;
-- 
1.8.1



More information about the systemd-devel mailing list