diff mbox

[7/9] pnfsd: LR_FLAG_EMPTY layout return flag

Message ID 1358780091-6151-1-git-send-email-bhalevy@tonian.com (mailing list archive)
State New, archived
Headers show

Commit Message

Benny Halevy Jan. 21, 2013, 2:54 p.m. UTC
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(-)
diff mbox

Patch

diff --git a/fs/nfsd/nfs4pnfsd.c b/fs/nfsd/nfs4pnfsd.c
index 2d4f23d..0b8c502 100644
--- a/fs/nfsd/nfs4pnfsd.c
+++ b/fs/nfsd/nfs4pnfsd.c
@@ -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 */
 	}
diff --git a/include/linux/nfsd/nfsd4_pnfs.h b/include/linux/nfsd/nfsd4_pnfs.h
index bfea9a6..ecb412e 100644
--- a/include/linux/nfsd/nfsd4_pnfs.h
+++ b/include/linux/nfsd/nfsd4_pnfs.h
@@ -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 {