From: Karel Zak Date: Tue, 4 Oct 2022 11:05:27 +0000 (+0200) Subject: libmount: (legacy) init regualer mount before propagation X-Git-Tag: v2.39-rc1~245 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a69d4278bb6556e109f168b5ba4cc41aead9b96c;p=thirdparty%2Futil-linux.git libmount: (legacy) init regualer mount before propagation 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 --- diff --git a/libmount/src/hook_mount_legacy.c b/libmount/src/hook_mount_legacy.c index 77603e5909..67ee686798 100644 --- a/libmount/src/hook_mount_legacy.c +++ b/libmount/src/hook_mount_legacy.c @@ -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; }