]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: use AT_RECURSIVE only when clone tree
authorKarel Zak <kzak@redhat.com>
Fri, 7 Oct 2022 10:18:03 +0000 (12:18 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 3 Jan 2023 11:58:42 +0000 (12:58 +0100)
It seems AT_RECURSIVE is usable for open_tree() only when
OPEN_TREE_CLONE specified too.

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

index 7d6e9a81d629a5990606878fae0924e67cf7d47a..76be86e328950b3466f9a579781d9b01446444e6 100644 (file)
@@ -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;