From 549a77cfb31c4813a39c83c2214ef36f34281661 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 7 Oct 2022 12:18:03 +0200 Subject: [PATCH] libmount: use AT_RECURSIVE only when clone tree It seems AT_RECURSIVE is usable for open_tree() only when OPEN_TREE_CLONE specified too. Signed-off-by: Karel Zak --- libmount/src/hook_mount.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libmount/src/hook_mount.c b/libmount/src/hook_mount.c index 7d6e9a81d6..76be86e328 100644 --- a/libmount/src/hook_mount.c +++ b/libmount/src/hook_mount.c @@ -396,14 +396,15 @@ static int init_sysapi(struct libmnt_context *cxt, if (path) { unsigned long oflg = OPEN_TREE_CLOEXEC; - if (mnt_optlist_is_recursive(cxt->optlist)) - oflg |= AT_RECURSIVE; - /* Classic -oremount,bind,ro is not bind operation, it's just * VFS flags update only */ - if ((flags & MS_BIND) && !(flags & MS_REMOUNT)) + if ((flags & MS_BIND) && !(flags & MS_REMOUNT)) { oflg |= OPEN_TREE_CLONE; + if (mnt_optlist_is_rbind(cxt->optlist)) + oflg |= AT_RECURSIVE; + } + DBG(HOOK, ul_debugobj(hs, "open_tree(path=%s, flgs=0x%08lx)", path, oflg)); if (mnt_context_is_fake(cxt)) goto fake; -- 2.47.2