]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: (legacy) init regualer mount before propagation
authorKarel Zak <kzak@redhat.com>
Tue, 4 Oct 2022 11:05:27 +0000 (13:05 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 3 Jan 2023 11:58:42 +0000 (12:58 +0100)
We have two ways how mount(2) is used, for propagation-only calls and
regular FS mount. The propagation-only code removes MS_PROPAGATION
flags from main mount options (=optlist), so any later decision about
propagation is impossible. We need to call propagation-only code as
the last thing. (Yes, new FD based mount(8) handles it better.)

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/hook_mount_legacy.c

index 77603e5909a09a87c802e3df8afceeadb977bdb6..67ee68679891d9dd011c8069376b23542d9a3043 100644 (file)
@@ -287,6 +287,11 @@ static int hook_prepare(struct libmnt_context *cxt,
        if (mnt_context_has_hook(cxt, &hookset_mount, 0, NULL))
                return 0;
 #endif
+       /* append regual FS mount(2) */
+       if (!mnt_context_propagation_only(cxt))
+               rc = mnt_context_append_hook(cxt, hs,
+                               MNT_STAGE_MOUNT, NULL, hook_mount);
+
        rc = mnt_context_get_mflags(cxt, &flags);
        if (rc)
                return rc;
@@ -307,11 +312,6 @@ static int hook_prepare(struct libmnt_context *cxt,
                        return rc;
        }
 
-       /* append regual FS mount(2) */
-       if (!mnt_context_propagation_only(cxt))
-               rc = mnt_context_append_hook(cxt, hs,
-                               MNT_STAGE_MOUNT, NULL, hook_mount);
-
        return rc;
 }