From: Jeff Layton <jlayton@kernel.org>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Jeff Layton <jlayton@kernel.org>
Subject: [PATCH] fs: grab current_time() in setattr_copy_mgtime() when ATTR_CTIME is unset
Date: Wed, 09 Oct 2024 12:26:32 -0400 [thread overview]
Message-ID: <20241009-mgtime-v1-1-383b9e0481b5@kernel.org> (raw)
With support of delegated timestamps, nfsd can issue a setattr that sets
the atime, but not the ctime. Ensure that when the ctime isn't set that
"now" is set to the current coarse-grained time.
Reported-by: Jan Kara <jack@suse.cz>
Closes: https://lore.kernel.org/linux-fsdevel/20241009153022.5uyp6aku2kcfeexp@quack3/
Fixes: d8d11298e8a1 ("fs: handle delegated timestamps in setattr_copy_mgtime")
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
A fix for bug that Jan reported. Christian, it may be best to fold this
into d8d11298e8a1.
---
fs/attr.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/attr.c b/fs/attr.c
index c614b954bda5244cc20ee82a98a8e68845f23bd7..9caf63d20d03e86c535e9c8c91d49c2a34d34b7a 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -298,6 +298,7 @@ static void setattr_copy_mgtime(struct inode *inode, const struct iattr *attr)
} else {
/* If ATTR_CTIME isn't set, then ATTR_MTIME shouldn't be either. */
WARN_ON_ONCE(ia_valid & ATTR_MTIME);
+ now = current_time(inode);
}
if (ia_valid & ATTR_ATIME_SET)
---
base-commit: 109aff7a3b294d9dc0f49d33fc6746e8d27e46f6
change-id: 20241009-mgtime-f672852d67cc
Best regards,
--
Jeff Layton <jlayton@kernel.org>
next reply other threads:[~2024-10-09 16:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 16:26 Jeff Layton [this message]
2024-10-09 16:56 ` Jan Kara
2024-10-10 8:21 ` Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241009-mgtime-v1-1-383b9e0481b5@kernel.org \
--to=jlayton@kernel.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®