aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-02-19 02:46:49 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-02-19 02:46:49 -0500
commitabd96698613eb27415e7028b6100be930920adc6 (patch)
tree8049bdcf2d4d9d699f26570424189261680f8a91 /fs/nfs
parent9937347a1ee6a67e450cc9e90750ce0b10abfe75 (diff)
NFS: Ensure struct nfs_client holds a reference to the net namespace
Otherwise we have no guarantee that the net namespace won't just disappear from underneath us once the task that created it is destroyed. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/client.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index d0f850ffeb19..8563585cccec 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -172,7 +172,7 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_
172 clp->cl_rpcclient = ERR_PTR(-EINVAL); 172 clp->cl_rpcclient = ERR_PTR(-EINVAL);
173 173
174 clp->cl_proto = cl_init->proto; 174 clp->cl_proto = cl_init->proto;
175 clp->net = cl_init->net; 175 clp->net = get_net(cl_init->net);
176 176
177#ifdef CONFIG_NFS_V4 177#ifdef CONFIG_NFS_V4
178 err = nfs_get_cb_ident_idr(clp, cl_init->minorversion); 178 err = nfs_get_cb_ident_idr(clp, cl_init->minorversion);
@@ -300,6 +300,7 @@ static void nfs_free_client(struct nfs_client *clp)
300 300
301 nfs4_deviceid_purge_client(clp); 301 nfs4_deviceid_purge_client(clp);
302 302
303 put_net(clp->net);
303 kfree(clp->cl_hostname); 304 kfree(clp->cl_hostname);
304 kfree(clp->server_scope); 305 kfree(clp->server_scope);
305 kfree(clp); 306 kfree(clp);