diff mbox series

[v2,06/92] cifs: update the ctime on a partial page write

Message ID 20230705190309.579783-6-jlayton@kernel.org
State New
Headers show
Series None | expand

Commit Message

Jeff Layton July 5, 2023, 7 p.m. UTC
POSIX says:

    "Upon successful completion, where nbyte is greater than 0, write()
     shall mark for update the last data modification and last file status
     change timestamps of the file..."

Add the missing ctime update.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/smb/client/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christian Brauner July 6, 2023, 7:11 a.m. UTC | #1
On Wed, Jul 05, 2023 at 11:50:15PM -0500, Steve French wrote:
> this looks useful (although we have a few more serious problems where we
> don't keep the cached mtime/ctime/size for files that have RW or RWH leases
> so can update the mtime/ctime/size from the server version of it which can
> be stale in cases where we are caching writes (with leases).
> 
> Which tree do you want this patch to go through?

Plan is to take it all through the vfs tree.
Steve French July 6, 2023, 3:26 p.m. UTC | #2
Reviewed-by: Steve French <stfrench@microsoft.com>

On Wed, Jul 5, 2023 at 2:04 PM Jeff Layton <jlayton@kernel.org> wrote:
>
> POSIX says:
>
>     "Upon successful completion, where nbyte is greater than 0, write()
>      shall mark for update the last data modification and last file status
>      change timestamps of the file..."
>
> Add the missing ctime update.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  fs/smb/client/file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
> index 879bc8e6555c..0a5fe8d5314b 100644
> --- a/fs/smb/client/file.c
> +++ b/fs/smb/client/file.c
> @@ -2596,7 +2596,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
>                                            write_data, to - from, &offset);
>                 cifsFileInfo_put(open_file);
>                 /* Does mm or vfs already set times? */
> -               inode->i_atime = inode->i_mtime = current_time(inode);
> +               inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
>                 if ((bytes_written > 0) && (offset))
>                         rc = 0;
>                 else if (bytes_written < 0)
> --
> 2.41.0
>
diff mbox series

Patch

diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index 879bc8e6555c..0a5fe8d5314b 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -2596,7 +2596,7 @@  static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
 					   write_data, to - from, &offset);
 		cifsFileInfo_put(open_file);
 		/* Does mm or vfs already set times? */
-		inode->i_atime = inode->i_mtime = current_time(inode);
+		inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
 		if ((bytes_written > 0) && (offset))
 			rc = 0;
 		else if (bytes_written < 0)