]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: (mount) use MOUNT_ATTR__ATIME
authorKarel Zak <kzak@redhat.com>
Fri, 7 Oct 2022 09:26:07 +0000 (11:26 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 3 Jan 2023 11:58:42 +0000 (12:58 +0100)
The atime related attributes for mount_setattr() requires MOUNT_ATTR__ATIME
in clear mask.

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

index f4b718d553aa4bee12d43a3f09a27d534041de75..754eb809f5c076496dbb8b322e6cef637ab0d31a 100644 (file)
@@ -851,7 +851,7 @@ end:
 int mnt_context_do_mount(struct libmnt_context *cxt)
 {
        const char *type;
-       int res, rc;
+       int res = 0, rc = 0;
        struct libmnt_ns *ns_old;
 
        assert(cxt);
@@ -884,9 +884,11 @@ int mnt_context_do_mount(struct libmnt_context *cxt)
                res = do_mount_by_pattern(cxt, cxt->fstype_pattern);
 
        /* after mount stage */
-       rc = mnt_context_call_hooks(cxt, MNT_STAGE_MOUNT_POST);
-       if (rc)
-               return rc;
+       if (res == 0) {
+               rc = mnt_context_call_hooks(cxt, MNT_STAGE_MOUNT_POST);
+               if (rc)
+                       return rc;
+       }
 
        if (!mnt_context_switch_ns(cxt, ns_old))
                return -MNT_ERR_NAMESPACE;
index 7e0dd312f6920484b8672b8dededb75a11321f68..7d6e9a81d629a5990606878fae0924e67cf7d47a 100644 (file)
 
 #define set_syscall_status(_cxt, _name, _x) __extension__ ({ \
                if (!(_x)) { \
+                       DBG(HOOK, ul_debug("syscall '%s' [%m]", _name)); \
                        (_cxt)->syscall_status = -errno; \
                        (_cxt)->syscall_name = (_name); \
-               } else \
+               } else { \
+                       DBG(HOOK, ul_debug("syscall '%s' [succes]", _name)); \
                        (_cxt)->syscall_status = 0; \
+               } \
        })
 
 
@@ -264,6 +267,9 @@ static int hook_set_vfsflags(struct libmnt_context *cxt,
        if (mnt_optlist_is_recursive(ol))
                callflags |= AT_RECURSIVE;
 
+       if (set & (MOUNT_ATTR_RELATIME | MOUNT_ATTR_NOATIME | MOUNT_ATTR_STRICTATIME))
+               clr |= MOUNT_ATTR__ATIME;
+
        DBG(HOOK, ul_debugobj(hs,
                        "mount_setattr(set=0x%08" PRIx64" clr=0x%08" PRIx64")", set, clr));
        attr.attr_set = set;
@@ -417,7 +423,7 @@ static int init_sysapi(struct libmnt_context *cxt,
                if (mnt_context_is_fake(cxt))
                        goto fake;
 
-               DBG(HOOK, ul_debugobj(hs, "fsopen(%s)", type));
+               DBG(HOOK, ul_debugobj(hs, " fsopen(%s)", type));
                if (mnt_context_is_fake(cxt))
                        goto fake;
 
index 7b4033aaa7aaf7ae74fc97541e4640e07f6bd28f..d7ef61a79b00ceff5d435da2a9fecd87997e7399 100644 (file)
@@ -800,10 +800,13 @@ int mnt_optlist_get_attrs(struct libmnt_optlist *ls, uint64_t *set, uint64_t *cl
                if (!x)
                        continue;
 
-               if (opt->ent->mask & MNT_INVERT)
+               if (opt->ent->mask & MNT_INVERT) {
+                       DBG(OPTLIST, ul_debugobj(ls, " clr: %s", opt->ent->name));
                        *clr |= x;
-               else
+               } else {
+                       DBG(OPTLIST, ul_debugobj(ls, " set: %s", opt->ent->name));
                        *set |= x;
+               }
        }
 
        DBG(OPTLIST, ul_debugobj(ls, "return attrs set=0x%08" PRIx64