]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mount: introduce mount_is_nofail() helper 15265/head
authorFranck Bui <fbui@suse.com>
Thu, 2 Apr 2020 06:58:31 +0000 (08:58 +0200)
committerFranck Bui <fbui@suse.com>
Thu, 9 Apr 2020 13:26:21 +0000 (15:26 +0200)
src/core/mount.c

index 0f51ac368f517e7cb23bf5aea156fb6c3a547de7..38024d1d284f5300e42f04e5a8cdfe03ee689076 100644 (file)
@@ -86,6 +86,15 @@ static bool mount_is_network(const MountParameters *p) {
         return false;
 }
 
+static bool mount_is_nofail(const Mount *m) {
+        assert(m);
+
+        if (!m->from_fragment)
+                return false;
+
+        return fstab_test_yes_no_option(m->parameters_fragment.options, "nofail\0" "fail\0");
+}
+
 static bool mount_is_loop(const MountParameters *p) {
         assert(p);
 
@@ -433,13 +442,10 @@ static int mount_add_default_ordering_dependencies(
                 UnitDependencyMask mask) {
 
         const char *after, *before, *e;
-        bool nofail;
         int r;
 
         assert(m);
 
-        nofail = m->from_fragment ? fstab_test_yes_no_option(m->parameters_fragment.options, "nofail\0" "fail\0") : false;
-
         e = path_startswith(m->where, "/sysroot");
         if (e && in_initrd()) {
                 /* All mounts under /sysroot need to happen later, at initrd-fs.target time. IOW,
@@ -458,7 +464,7 @@ static int mount_add_default_ordering_dependencies(
                 before = SPECIAL_LOCAL_FS_TARGET;
         }
 
-        if (!nofail && !mount_is_automount(p)) {
+        if (!mount_is_nofail(m) && !mount_is_automount(p)) {
                 r = unit_add_dependency_by_name(UNIT(m), UNIT_BEFORE, before, true, mask);
                 if (r < 0)
                         return r;