diff mbox

[27/38] pnfsd: layout state: introduce ls_file backpointer

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

Commit Message

Benny Halevy May 11, 2013, 2:44 a.m. UTC
Signed-off-by: Benny Halevy <bhalevy@tonian.com>
---
 fs/nfsd/nfs4pnfsd.c | 3 +++
 fs/nfsd/pnfsd.h     | 1 +
 2 files changed, 4 insertions(+)
diff mbox

Patch

diff --git a/fs/nfsd/nfs4pnfsd.c b/fs/nfsd/nfs4pnfsd.c
index 6e0e9d1..b147427 100644
--- a/fs/nfsd/nfs4pnfsd.c
+++ b/fs/nfsd/nfs4pnfsd.c
@@ -132,6 +132,8 @@  struct sbid_tracker {
 	kref_init(&new->ls_ref);
 	nfsd4_init_stid(&new->ls_stid, clp, NFS4_LAYOUT_STID);
 	INIT_LIST_HEAD(&new->ls_perfile);
+	get_nfs4_file(fp);	/* released on destroy_layout_state */
+	new->ls_file = fp;
 	new->ls_roc = false;
 	spin_lock(&layout_lock);
 	list_add(&new->ls_perfile, &fp->fi_lo_states);
@@ -157,6 +159,7 @@  struct sbid_tracker {
 		list_del(&ls->ls_perfile);
 		spin_unlock(&layout_lock);
 	}
+	put_nfs4_file(ls->ls_file);
 	kmem_cache_free(layout_state_slab, ls);
 }
 
diff --git a/fs/nfsd/pnfsd.h b/fs/nfsd/pnfsd.h
index 2507d31..6301c51 100644
--- a/fs/nfsd/pnfsd.h
+++ b/fs/nfsd/pnfsd.h
@@ -45,6 +45,7 @@  struct nfs4_layout_state {
 	struct nfs4_stid	ls_stid; /* must be first field */
 	struct kref		ls_ref;
 	struct list_head	ls_perfile;
+	struct nfs4_file	*ls_file;
 	bool			ls_roc;
 };