On Wed, Sep 10, 2014 at 11:23 PM, Christoph Hellwig <hch@xxxxxx> wrote: > If a layout driver keeps per-inode state outside of the layout segments it > needs to be notified of any layout returns or recalls on an inode, and not > just about the freeing of layout segments. Add a method to acomplish this, > which will allow the block layout driver to handle the case of truncated > and re-expanded files properly. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > --- > fs/nfs/callback_proc.c | 12 +++++++++--- > fs/nfs/pnfs.c | 10 ++++++++++ > fs/nfs/pnfs.h | 3 +++ > 3 files changed, 22 insertions(+), 3 deletions(-) > > diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c > index 0d26951..56bd0ea 100644 > --- a/fs/nfs/callback_proc.c > +++ b/fs/nfs/callback_proc.c > @@ -181,10 +181,16 @@ static u32 initiate_file_draining(struct nfs_client *clp, > spin_lock(&ino->i_lock); > if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) || > pnfs_mark_matching_lsegs_invalid(lo, &free_me_list, > - &args->cbl_range)) > + &args->cbl_range)) { > rv = NFS4ERR_DELAY; > - else > - rv = NFS4ERR_NOMATCHING_LAYOUT; > + goto unlock; > + } > + > + if (NFS_SERVER(ino)->pnfs_curr_ld->return_range) { It looks better to put return_range inside pnfs_mark_matching_lsegs_invalid() to have it called every time a range of layout segments all get freed. So that ld is sure to free things up. Cheers, Tao -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html