From 3f58dcaaec21a372cab721092583a83f9b8b1b63 Mon Sep 17 00:00:00 2001 From: gexuyang Date: Fri, 26 Mar 2021 15:48:22 +0800 Subject: [PATCH 2640/2944] alinux: 9P: update inode [cm]time when write fix #33633860 * Call file_update_time in v9fs_file_write_iter to update inode [cm]time. The getstat interface will get old [cm]time of inode that does not update [cm]time in Write. * Set the time granularity of 9P to 1ns. Fixes: 291d5c48bf02 ("NO-UPSTREAM: 9P: always use cached inode to fill in v9fs_vfs_getattr") Reviewed-by: Joseph Qi Reviewed-by: Eryu Guan Reviewed-by: Peng Tao Reviewed-by: Liu Bo Signed-off-by: gexuyang --- fs/9p/vfs_file.c | 4 ++++ fs/9p/vfs_super.c | 1 + 2 files changed, 5 insertions(+) diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 550d0b1..9ca8ec2 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -431,6 +431,10 @@ static int v9fs_file_flock_dotl(struct file *filp, int cmd, if (retval <= 0) return retval; + err = file_update_time(file); + if (err) + return err; + origin = iocb->ki_pos; retval = p9_client_write(file->private_data, iocb->ki_pos, from, &err); if (retval > 0) { diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index eeab995..1bb3c58 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c @@ -81,6 +81,7 @@ static int v9fs_set_super(struct super_block *s, void *data) sb->s_blocksize_bits = fls(v9ses->maxdata - 1); sb->s_blocksize = 1 << sb->s_blocksize_bits; sb->s_magic = V9FS_MAGIC; + sb->s_time_gran = 1; if (v9fs_proto_dotl(v9ses)) { sb->s_op = &v9fs_super_ops_dotl; sb->s_xattr = v9fs_xattr_handlers; -- 1.8.3.1