From: Xiubo Li <xiubli@xxxxxxxxxx> Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx> --- fs/ceph/inode.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 45ca4e598ef0..f4059d73edd5 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2275,8 +2275,12 @@ 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)) { + ret = filemap_write_and_wait_range(inode->i_mapping, + orig_pos, LLONG_MAX); + if (ret < 0) + goto out; + } page = __page_cache_alloc(GFP_KERNEL); if (page == NULL) { -- 2.27.0