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. We can just buffer the truncate in this case. Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx> --- fs/ceph/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 03530793c969..14989b961431 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2370,7 +2370,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr, struct ceph_iattr *c 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) { + 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; -- 2.27.0