From: Xiubo Li <xiubli@xxxxxxxxxx> This reverts commit c97968122078ce0380cd8db405b8505a8b0a55d8. --- fs/ceph/file.c | 3 ++- fs/ceph/inode.c | 23 ++--------------------- fs/ceph/super.h | 1 - 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index ee13512b610d..af58be73ce1c 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -2250,7 +2250,8 @@ static void ceph_zero_pagecache_range(struct inode *inode, loff_t offset, ceph_zero_partial_page(inode, offset, length); } -int ceph_zero_partial_object(struct inode *inode, loff_t offset, loff_t *length) +static int ceph_zero_partial_object(struct inode *inode, + loff_t offset, loff_t *length) { struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_fs_client *fsc = ceph_inode_to_client(inode); diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 5d47b98b61af..9b798690fdc9 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2393,6 +2393,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr, struct ceph_iattr *c cpu_to_le64(round_up(isize, CEPH_FSCRYPT_BLOCK_SIZE)); req->r_fscrypt_file = attr->ia_size; + /* FIXME: client must zero out any partial blocks! */ } else { req->r_args.setattr.size = cpu_to_le64(attr->ia_size); req->r_args.setattr.old_size = cpu_to_le64(isize); @@ -2481,28 +2482,8 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr, struct ceph_iattr *c ceph_mdsc_put_request(req); ceph_free_cap_flush(prealloc_cf); - if (err >= 0 && (mask & (CEPH_SETATTR_SIZE|CEPH_SETATTR_FSCRYPT_FILE))) { + if (err >= 0 && (mask & CEPH_SETATTR_SIZE)) __ceph_do_pending_vmtruncate(inode); - if (mask & CEPH_SETATTR_FSCRYPT_FILE) { - loff_t orig_len, len; - - len = round_up(attr->ia_size, CEPH_FSCRYPT_BLOCK_SIZE) - attr->ia_size; - orig_len = len; - - /* - * FIXME: this is just doing the truncating the last OSD - * object, but for "real" fscrypt support, we need - * to do a RMW with the end of the block zeroed out. - */ - if (len) { - err = ceph_zero_partial_object(inode, attr->ia_size, &len); - /* This had better not be shortened */ - WARN_ONCE(!err && len != orig_len, - "attr->ia_size=%lld orig_len=%lld len=%lld\n", - attr->ia_size, orig_len, len); - } - } - } return err; } diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 6d4a22c6d32d..7f3976b3319d 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -1236,7 +1236,6 @@ extern int ceph_atomic_open(struct inode *dir, struct dentry *dentry, extern int ceph_release(struct inode *inode, struct file *filp); extern void ceph_fill_inline_data(struct inode *inode, struct page *locked_page, char *data, size_t len); -int ceph_zero_partial_object(struct inode *inode, loff_t offset, loff_t *length); /* dir.c */ extern const struct file_operations ceph_dir_fops; -- 2.27.0