On Thu, 2022-04-07 at 22:41 +0800, xiubli@xxxxxxxxxx wrote: > 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; > + } > > Not much point in writing back blocks we're just going to truncate away anyhow. Maybe this should be writing with this range? orig_pos, orig_pos + CEPH_FSCRYPT_BLOCK_SIZE - 1 > > page = __page_cache_alloc(GFP_KERNEL); > if (page == NULL) { -- Jeff Layton <jlayton@xxxxxxxxxx>