summaryrefslogtreecommitdiff
path: root/fs/nfs/client.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-02-07 00:05:11 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-02-15 00:19:49 -0500
commit4c03ae4a897b52e0e8fc38749606549eaa20d5b7 (patch)
tree91d16026684c82e841f78cbc88e61d518eb701c4 /fs/nfs/client.c
parent3b64739fb928c34b13db6b5adcb0d3efb19e78be (diff)
NFS: Initialise the nfs_net->nfs_client_lock
Ensure that we initialise the nfs_net->nfs_client_lock spinlock. Also ensure that nfs_server_remove_lists() doesn't try to dereference server->nfs_client before that is initialised. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r--fs/nfs/client.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 1a5cd49dff80..6f6267cb6bad 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1055,11 +1055,14 @@ static void nfs_server_insert_lists(struct nfs_server *server)
static void nfs_server_remove_lists(struct nfs_server *server)
{
struct nfs_client *clp = server->nfs_client;
- struct nfs_net *nn = net_generic(clp->net, nfs_net_id);
+ struct nfs_net *nn;
+ if (clp == NULL)
+ return;
+ nn = net_generic(clp->net, nfs_net_id);
spin_lock(&nn->nfs_client_lock);
list_del_rcu(&server->client_link);
- if (clp && list_empty(&clp->cl_superblocks))
+ if (list_empty(&clp->cl_superblocks))
set_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state);
list_del(&server->master_link);
spin_unlock(&nn->nfs_client_lock);
@@ -1777,6 +1780,7 @@ void nfs_clients_init(struct net *net)
#ifdef CONFIG_NFS_V4
idr_init(&nn->cb_ident_idr);
#endif
+ spin_lock_init(&nn->nfs_client_lock);
}
#ifdef CONFIG_PROC_FS