chiark / gitweb /
mount: only add those mount points to localfs.target as Wants that are marked for us
[elogind.git] / mount.c
diff --git a/mount.c b/mount.c
index 04edc6e10fad510722382a28b824029865d3f9c5..2e3abcc6bc4a080db8f50b6ebe6a8eaa6594d15f 100644 (file)
--- a/mount.c
+++ b/mount.c
@@ -244,6 +244,8 @@ static int mount_add_target_links(Mount *m) {
         MountParameters *p;
         Unit *u;
         int r;
+        bool noauto;
+        bool handle;
 
         assert(m);
 
@@ -254,10 +256,10 @@ static int mount_add_target_links(Mount *m) {
         else
                 return 0;
 
-        if (!p->fstype)
-                return 0;
+        noauto = mount_test_option(p->options, MNTOPT_NOAUTO);
+        handle = mount_test_option(p->options, "comment=systemd.mount");
 
-        if (mount_test_option(p->options, MNTOPT_NOAUTO))
+        if (noauto && !handle)
                 return 0;
 
         if (mount_test_option(p->options, "_netdev") ||
@@ -269,8 +271,9 @@ static int mount_add_target_links(Mount *m) {
         if ((r = manager_load_unit(UNIT(m)->meta.manager, target, &u)) < 0)
                 return r;
 
-        if ((r = unit_add_dependency(u, UNIT_WANTS, UNIT(m))) < 0)
-                return r;
+        if (handle)
+                if ((r = unit_add_dependency(u, UNIT_WANTS, UNIT(m))) < 0)
+                        return r;
 
         return unit_add_dependency(UNIT(m), UNIT_BEFORE, u);
 }
@@ -720,6 +723,12 @@ static UnitActiveState mount_active_state(Unit *u) {
         return state_translation_table[MOUNT(u)->state];
 }
 
+static const char *mount_sub_state_to_string(Unit *u) {
+        assert(u);
+
+        return state_string_table[MOUNT(u)->state];
+}
+
 static void mount_sigchld_event(Unit *u, pid_t pid, int code, int status) {
         Mount *m = MOUNT(u);
         bool success;
@@ -1286,6 +1295,7 @@ const UnitVTable mount_vtable = {
         .reload = mount_reload,
 
         .active_state = mount_active_state,
+        .sub_state_to_string = mount_sub_state_to_string,
 
         .sigchld_event = mount_sigchld_event,
         .timer_event = mount_timer_event,