aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2012-09-12 09:51:34 -0400
committerJ. Bruce Fields <bfields@redhat.com>2012-10-01 17:40:01 -0400
commita827bcb242ecc884d38af8145e1d9a112b739b35 (patch)
tree7d808c3ec73f236f33c18ea8040339f81b55ae68 /fs/nfsd
parent1377b69e68241826761d257ac26dd4285c3f9e9b (diff)
nfsd4: clean up session allocation
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4state.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 7536a88063a5..79f1fdb22dc7 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -758,7 +758,7 @@ static void nfsd4_put_drc_mem(int slotsize, int num)
758 spin_unlock(&nfsd_drc_lock); 758 spin_unlock(&nfsd_drc_lock);
759} 759}
760 760
761static struct nfsd4_session *alloc_session(int slotsize, int numslots) 761static struct nfsd4_session *__alloc_session(int slotsize, int numslots)
762{ 762{
763 struct nfsd4_session *new; 763 struct nfsd4_session *new;
764 int mem, i; 764 int mem, i;
@@ -921,14 +921,10 @@ void nfsd4_put_session(struct nfsd4_session *ses)
921 spin_unlock(&client_lock); 921 spin_unlock(&client_lock);
922} 922}
923 923
924static struct nfsd4_session *alloc_init_session(struct svc_rqst *rqstp, struct nfs4_client *clp, struct nfsd4_create_session *cses) 924static struct nfsd4_session *alloc_session(struct nfsd4_channel_attrs *fchan)
925{ 925{
926 struct nfsd4_session *new; 926 struct nfsd4_session *new;
927 struct nfsd4_conn *conn;
928 struct nfsd4_channel_attrs *fchan = &cses->fore_channel;
929 int numslots, slotsize; 927 int numslots, slotsize;
930 int idx;
931
932 /* 928 /*
933 * Note decreasing slot size below client's request may 929 * Note decreasing slot size below client's request may
934 * make it difficult for client to function correctly, whereas 930 * make it difficult for client to function correctly, whereas
@@ -941,13 +937,30 @@ static struct nfsd4_session *alloc_init_session(struct svc_rqst *rqstp, struct n
941 if (numslots < 1) 937 if (numslots < 1)
942 return NULL; 938 return NULL;
943 939
944 new = alloc_session(slotsize, numslots); 940 new = __alloc_session(slotsize, numslots);
945 if (!new) { 941 if (!new) {
946 nfsd4_put_drc_mem(slotsize, fchan->maxreqs); 942 nfsd4_put_drc_mem(slotsize, fchan->maxreqs);
947 return NULL; 943 return NULL;
948 } 944 }
949 init_forechannel_attrs(&new->se_fchannel, fchan, numslots, slotsize); 945 init_forechannel_attrs(&new->se_fchannel, fchan, numslots, slotsize);
946 return new;
947}
950 948
949static struct nfsd4_session *alloc_init_session(struct svc_rqst *rqstp, struct nfs4_client *clp, struct nfsd4_create_session *cses)
950{
951 struct nfsd4_session *new;
952 struct nfsd4_conn *conn;
953 int idx;
954
955 new = alloc_session(&cses->fore_channel);
956 if (!new)
957 return NULL;
958
959 conn = alloc_conn_from_crses(rqstp, cses);
960 if (!conn) {
961 __free_session(new);
962 return NULL;
963 }
951 new->se_client = clp; 964 new->se_client = clp;
952 gen_sessionid(new); 965 gen_sessionid(new);
953 966
@@ -965,11 +978,6 @@ static struct nfsd4_session *alloc_init_session(struct svc_rqst *rqstp, struct n
965 spin_unlock(&clp->cl_lock); 978 spin_unlock(&clp->cl_lock);
966 spin_unlock(&client_lock); 979 spin_unlock(&client_lock);
967 980
968 conn = alloc_conn_from_crses(rqstp, cses);
969 if (!conn) {
970 __free_session(new);
971 return NULL;
972 }
973 nfsd4_init_conn(rqstp, conn, new); 981 nfsd4_init_conn(rqstp, conn, new);
974 if (cses->flags & SESSION4_BACK_CHAN) { 982 if (cses->flags & SESSION4_BACK_CHAN) {
975 struct sockaddr *sa = svc_addr(rqstp); 983 struct sockaddr *sa = svc_addr(rqstp);