aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2012-09-11 15:37:40 -0400
committerJ. Bruce Fields <bfields@redhat.com>2012-10-01 17:39:59 -0400
commit3ba6367124f3f07c91ea45a3ea24bbf4c5429bfc (patch)
tree6809e44b3c33c0fdd6639e5115142c8bac92fc7a /fs/nfsd/nfs4state.c
parent497305014864ea9e32adf7e8a06081209a5e7c42 (diff)
nfsd4: separate connection allocation and initialization
It'll be useful to have connection allocation and initialization as separate functions. Also, note we'd been ignoring the alloc_conn error return in bind_conn_to_session. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 64938ca05c6d..101ccd856e6a 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -852,14 +852,10 @@ static int nfsd4_register_conn(struct nfsd4_conn *conn)
852 return register_xpt_user(conn->cn_xprt, &conn->cn_xpt_user); 852 return register_xpt_user(conn->cn_xprt, &conn->cn_xpt_user);
853} 853}
854 854
855static __be32 nfsd4_new_conn(struct svc_rqst *rqstp, struct nfsd4_session *ses, u32 dir) 855static void nfsd4_init_conn(struct svc_rqst *rqstp, struct nfsd4_conn *conn, struct nfsd4_session *ses, u32 dir)
856{ 856{
857 struct nfsd4_conn *conn;
858 int ret; 857 int ret;
859 858
860 conn = alloc_conn(rqstp, dir);
861 if (!conn)
862 return nfserr_jukebox;
863 nfsd4_hash_conn(conn, ses); 859 nfsd4_hash_conn(conn, ses);
864 ret = nfsd4_register_conn(conn); 860 ret = nfsd4_register_conn(conn);
865 if (ret) 861 if (ret)
@@ -870,17 +866,21 @@ static __be32 nfsd4_new_conn(struct svc_rqst *rqstp, struct nfsd4_session *ses,
870 /* callback channel may be back up */ 866 /* callback channel may be back up */
871 nfsd4_probe_callback(ses->se_client); 867 nfsd4_probe_callback(ses->se_client);
872 } 868 }
873 return nfs_ok;
874} 869}
875 870
876static __be32 nfsd4_new_conn_from_crses(struct svc_rqst *rqstp, struct nfsd4_session *ses) 871static __be32 nfsd4_new_conn_from_crses(struct svc_rqst *rqstp, struct nfsd4_session *ses)
877{ 872{
873 struct nfsd4_conn *conn;
878 u32 dir = NFS4_CDFC4_FORE; 874 u32 dir = NFS4_CDFC4_FORE;
879 875
880 if (ses->se_flags & SESSION4_BACK_CHAN) 876 if (ses->se_flags & SESSION4_BACK_CHAN)
881 dir |= NFS4_CDFC4_BACK; 877 dir |= NFS4_CDFC4_BACK;
882 878
883 return nfsd4_new_conn(rqstp, ses, dir); 879 conn = alloc_conn(rqstp, dir);
880 if (!conn)
881 return nfserr_jukebox;
882 nfsd4_init_conn(rqstp, conn, ses, dir);
883 return nfs_ok;
884} 884}
885 885
886/* must be called under client_lock */ 886/* must be called under client_lock */
@@ -1868,6 +1868,7 @@ __be32 nfsd4_bind_conn_to_session(struct svc_rqst *rqstp,
1868 struct nfsd4_bind_conn_to_session *bcts) 1868 struct nfsd4_bind_conn_to_session *bcts)
1869{ 1869{
1870 __be32 status; 1870 __be32 status;
1871 struct nfsd4_conn *conn;
1871 1872
1872 if (!nfsd4_last_compound_op(rqstp)) 1873 if (!nfsd4_last_compound_op(rqstp))
1873 return nfserr_not_only_op; 1874 return nfserr_not_only_op;
@@ -1884,9 +1885,13 @@ __be32 nfsd4_bind_conn_to_session(struct svc_rqst *rqstp,
1884 return nfserr_badsession; 1885 return nfserr_badsession;
1885 1886
1886 status = nfsd4_map_bcts_dir(&bcts->dir); 1887 status = nfsd4_map_bcts_dir(&bcts->dir);
1887 if (!status) 1888 if (status)
1888 nfsd4_new_conn(rqstp, cstate->session, bcts->dir); 1889 return status;
1889 return status; 1890 conn = alloc_conn(rqstp, bcts->dir);
1891 if (!conn)
1892 return nfserr_jukebox;
1893 nfsd4_init_conn(rqstp, conn, cstate->session, bcts->dir);
1894 return nfs_ok;
1890} 1895}
1891 1896
1892static bool nfsd4_compound_in_session(struct nfsd4_session *session, struct nfs4_sessionid *sid) 1897static bool nfsd4_compound_in_session(struct nfsd4_session *session, struct nfs4_sessionid *sid)