@@ -921,15 +921,21 @@ struct super_block *
struct inode *inode = lo->lo_file->fi_inode;
struct nfsd4_pnfs_layoutreturn lr;
bool empty;
+ int lr_flags = flags;
memset(&lr, 0, sizeof(lr));
lr.args.lr_return_type = RETURN_FILE;
lr.args.lr_seg = lo->lo_seg;
+ spin_lock(&layout_lock);
+ if (list_empty(&lo->lo_file->fi_layouts))
+ lr_flags |= LR_FLAG_EMPTY;
+ spin_unlock(&layout_lock);
+
list_del(&lo->lo_perfile);
empty = list_empty(lo_destroy_list);
- fs_layout_return(inode, &lr, flags, empty ? cb_cookie : NULL);
+ fs_layout_return(inode, &lr, lr_flags, empty ? cb_cookie : NULL);
destroy_layout(lo); /* this will put the lo_file */
}
@@ -114,6 +114,7 @@ enum layoutreturn_flags {
LR_FLAG_INTERN = 1 << 0, /* internal return */
LR_FLAG_EXPIRE = 1 << 1, /* return on client expiration */
LR_FLAG_CL_EMPTY = 1 << 2, /* No more layout for returning client */
+ LR_FLAG_EMPTY = 1 << 3, /* No more layout for file */
};
struct nfsd4_pnfs_layoutreturn_arg {
Signed-off-by: Benny Halevy <bhalevy@tonian.com> --- fs/nfsd/nfs4pnfsd.c | 8 +++++++- include/linux/nfsd/nfsd4_pnfs.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-)