@@ -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);
}
@@ -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;
};
Signed-off-by: Benny Halevy <bhalevy@tonian.com> --- fs/nfsd/nfs4pnfsd.c | 3 +++ fs/nfsd/pnfsd.h | 1 + 2 files changed, 4 insertions(+)