On Fri, 2021-10-08 at 16:23 +0800, xiubli@xxxxxxxxxx wrote: > From: Xiubo Li <xiubli@xxxxxxxxxx> > > If the new size is the same with current size, the MDS will do nothing > except changing the mtime/atime. The posix doesn't mandate that the > filesystems must update them. So just ignore it. > > Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx> > --- > fs/ceph/inode.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c > index 23b5a0867e3a..81a7b342fae7 100644 > --- a/fs/ceph/inode.c > +++ b/fs/ceph/inode.c > @@ -2105,12 +2105,14 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) > loff_t isize = i_size_read(inode); > > dout("setattr %p size %lld -> %lld\n", inode, isize, attr->ia_size); > - if ((issued & CEPH_CAP_FILE_EXCL) && attr->ia_size > isize) { > - i_size_write(inode, attr->ia_size); > - inode->i_blocks = calc_inode_blocks(attr->ia_size); > - ci->i_reported_size = attr->ia_size; > - dirtied |= CEPH_CAP_FILE_EXCL; > - ia_valid |= ATTR_MTIME; > + if ((issued & CEPH_CAP_FILE_EXCL) && attr->ia_size >= isize) { > + if (attr->ia_size > isize) { > + i_size_write(inode, attr->ia_size); > + inode->i_blocks = calc_inode_blocks(attr->ia_size); > + ci->i_reported_size = attr->ia_size; > + dirtied |= CEPH_CAP_FILE_EXCL; > + ia_valid |= ATTR_MTIME; > + } > } else if ((issued & CEPH_CAP_FILE_SHARED) == 0 || > attr->ia_size != isize) { > req->r_args.setattr.size = cpu_to_le64(attr->ia_size); Thanks Xiubo, looks good. Merged into testing. -- Jeff Layton <jlayton@xxxxxxxxxx>