From a69d4278bb6556e109f168b5ba4cc41aead9b96c Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 4 Oct 2022 13:05:27 +0200 Subject: [PATCH] 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 --- libmount/src/hook_mount_legacy.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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; } -- 2.47.2