* [PATCH] fs: grab current_time() in setattr_copy_mgtime() when ATTR_CTIME is unset
@ 2024-10-09 16:26 Jeff Layton
2024-10-09 16:56 ` Jan Kara
2024-10-10 8:21 ` Christian Brauner
0 siblings, 2 replies; 3+ messages in thread
From: Jeff Layton @ 2024-10-09 16:26 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jeff Layton
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: grab current_time() in setattr_copy_mgtime() when ATTR_CTIME is unset
2024-10-09 16:26 [PATCH] fs: grab current_time() in setattr_copy_mgtime() when ATTR_CTIME is unset Jeff Layton
@ 2024-10-09 16:56 ` Jan Kara
2024-10-10 8:21 ` Christian Brauner
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2024-10-09 16:56 UTC (permalink / raw)
To: Jeff Layton
Cc: Alexander Viro, Christian Brauner, Jan Kara, linux-fsdevel, linux-kernel
On Wed 09-10-24 12:26:32, Jeff Layton wrote:
> 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.
Looks good to me. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
although I agree with Jeff it's best to fold this into the original patch.
Honza
> ---
> 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>
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: grab current_time() in setattr_copy_mgtime() when ATTR_CTIME is unset
2024-10-09 16:26 [PATCH] fs: grab current_time() in setattr_copy_mgtime() when ATTR_CTIME is unset Jeff Layton
2024-10-09 16:56 ` Jan Kara
@ 2024-10-10 8:21 ` Christian Brauner
1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2024-10-10 8:21 UTC (permalink / raw)
To: Jan Kara, Jeff Layton
Cc: Christian Brauner, linux-fsdevel, linux-kernel, Alexander Viro
On Wed, 09 Oct 2024 12:26:32 -0400, Jeff Layton wrote:
> 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.
>
>
Folded into the original patch.
---
Applied to the vfs.mgtime branch of the vfs/vfs.git tree.
Patches in the vfs.mgtime branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.mgtime
[1/1] fs: grab current_time() in setattr_copy_mgtime() when ATTR_CTIME is unset
(no commit info)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-10 8:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-09 16:26 [PATCH] fs: grab current_time() in setattr_copy_mgtime() when ATTR_CTIME is unset Jeff Layton
2024-10-09 16:56 ` Jan Kara
2024-10-10 8:21 ` Christian Brauner
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®