Message ID | 20220412070745.22795-2-xiubli@redhat.com |
---|---|
State | New |
Headers | show |
Series | ceph: misc fix size truncate for fscrypt | expand |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index fa0d3018d981..a5145a2b7228 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2274,8 +2274,13 @@ static int fill_fscrypt_truncate(struct inode *inode, ceph_cap_string(issued)); /* Try to writeback the dirty pagecaches */ - if (issued & (CEPH_CAP_FILE_BUFFER)) - filemap_write_and_wait(inode->i_mapping); + if (issued & (CEPH_CAP_FILE_BUFFER)) { + loff_t lend = orig_pos + CEPH_FSCRYPT_BLOCK_SHIFT - 1; + ret = filemap_write_and_wait_range(inode->i_mapping, + orig_pos, lend); + if (ret < 0) + goto out; + } page = __page_cache_alloc(GFP_KERNEL); if (page == NULL) {
Signed-off-by: Xiubo Li <xiubli@redhat.com> --- fs/ceph/inode.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)