aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2013-03-18 17:31:30 -0400
committerJ. Bruce Fields <bfields@redhat.com>2013-04-03 11:48:39 -0400
commit4f6e6c17733ecf01c05a693ced8349ccf8101fd8 (patch)
treeece553ed54e04990a9adc08840f0a3b019db7ea5 /fs/nfsd/nfs4state.c
parentabcdff09a05117112aa22cd84939039655bca710 (diff)
nfsd4: simplify bind_conn_to_session locking
The locking here is very fiddly, and there's no reason for us to be setting cstate->session, since this is the only op in the compound. Let's just take the state lock and drop the reference counting. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 8cc668dc4997..8e83cef4d0bd 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1887,30 +1887,30 @@ __be32 nfsd4_bind_conn_to_session(struct svc_rqst *rqstp,
1887{ 1887{
1888 __be32 status; 1888 __be32 status;
1889 struct nfsd4_conn *conn; 1889 struct nfsd4_conn *conn;
1890 struct nfsd4_session *session;
1890 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); 1891 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
1891 1892
1892 if (!nfsd4_last_compound_op(rqstp)) 1893 if (!nfsd4_last_compound_op(rqstp))
1893 return nfserr_not_only_op; 1894 return nfserr_not_only_op;
1895 nfs4_lock_state();
1894 spin_lock(&nn->client_lock); 1896 spin_lock(&nn->client_lock);
1895 cstate->session = find_in_sessionid_hashtbl(&bcts->sessionid, SVC_NET(rqstp)); 1897 session = find_in_sessionid_hashtbl(&bcts->sessionid, SVC_NET(rqstp));
1896 /* Sorta weird: we only need the refcnt'ing because new_conn acquires
1897 * client_lock iself: */
1898 if (cstate->session) {
1899 nfsd4_get_session(cstate->session);
1900 atomic_inc(&cstate->session->se_client->cl_refcount);
1901 }
1902 spin_unlock(&nn->client_lock); 1898 spin_unlock(&nn->client_lock);
1903 if (!cstate->session) 1899 status = nfserr_badsession;
1904 return nfserr_badsession; 1900 if (!session)
1905 1901 goto out;
1906 status = nfsd4_map_bcts_dir(&bcts->dir); 1902 status = nfsd4_map_bcts_dir(&bcts->dir);
1907 if (status) 1903 if (status)
1908 return status; 1904 goto out;
1909 conn = alloc_conn(rqstp, bcts->dir); 1905 conn = alloc_conn(rqstp, bcts->dir);
1906 status = nfserr_jukebox;
1910 if (!conn) 1907 if (!conn)
1911 return nfserr_jukebox; 1908 goto out;
1912 nfsd4_init_conn(rqstp, conn, cstate->session); 1909 nfsd4_init_conn(rqstp, conn, session);
1913 return nfs_ok; 1910 status = nfs_ok;
1911out:
1912 nfs4_unlock_state();
1913 return status;
1914} 1914}
1915 1915
1916static bool nfsd4_compound_in_session(struct nfsd4_session *session, struct nfs4_sessionid *sid) 1916static bool nfsd4_compound_in_session(struct nfsd4_session *session, struct nfs4_sessionid *sid)