diff mbox series

[2/2] ceph: there is no need to round up the sizes when new size is 0

Message ID 20211108135012.79941-3-xiubli@redhat.com (mailing list archive)
State New, archived
Headers show
Series ceph: misc fixes for the fscrypt truncate size handling | expand

Commit Message

Xiubo Li Nov. 8, 2021, 1:50 p.m. UTC
From: Xiubo Li <xiubli@redhat.com>

Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index b371f596b97d..1b4ce453d397 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -2560,7 +2560,7 @@  int __ceph_setattr(struct inode *inode, struct iattr *attr, struct ceph_iattr *c
 			mask |= CEPH_SETATTR_SIZE;
 			release |= CEPH_CAP_FILE_SHARED | CEPH_CAP_FILE_EXCL |
 				   CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR;
-			if (IS_ENCRYPTED(inode)) {
+			if (IS_ENCRYPTED(inode) && attr->ia_size) {
 				set_bit(CEPH_MDS_R_FSCRYPT_FILE, &req->r_req_flags);
 				mask |= CEPH_SETATTR_FSCRYPT_FILE;
 				req->r_args.setattr.size =