From: Karel Zak Date: Fri, 7 Oct 2022 09:26:07 +0000 (+0200) Subject: libmount: (mount) use MOUNT_ATTR__ATIME X-Git-Tag: v2.39-rc1~241 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=12679d8ec2a66f78f22a95f4252f3c1ab438f7e0;p=thirdparty%2Futil-linux.git libmount: (mount) use MOUNT_ATTR__ATIME The atime related attributes for mount_setattr() requires MOUNT_ATTR__ATIME in clear mask. Signed-off-by: Karel Zak --- diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index f4b718d553..754eb809f5 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -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; diff --git a/libmount/src/hook_mount.c b/libmount/src/hook_mount.c index 7e0dd312f6..7d6e9a81d6 100644 --- a/libmount/src/hook_mount.c +++ b/libmount/src/hook_mount.c @@ -50,10 +50,13 @@ #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; diff --git a/libmount/src/optlist.c b/libmount/src/optlist.c index 7b4033aaa7..d7ef61a79b 100644 --- a/libmount/src/optlist.c +++ b/libmount/src/optlist.c @@ -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