Commit aacd5537 authored by Andy Adamson's avatar Andy Adamson Committed by Trond Myklebust

NFSv4.1: cleanup init and reset of session slot tables

We are either initializing or resetting a session. Initialize or reset
the session slot tables accordingly.
Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 61f2e510
...@@ -5021,23 +5021,6 @@ static int nfs4_reset_slot_table(struct nfs4_slot_table *tbl, u32 max_reqs, ...@@ -5021,23 +5021,6 @@ static int nfs4_reset_slot_table(struct nfs4_slot_table *tbl, u32 max_reqs,
return ret; return ret;
} }
/*
* Reset the forechannel and backchannel slot tables
*/
static int nfs4_reset_slot_tables(struct nfs4_session *session)
{
int status;
status = nfs4_reset_slot_table(&session->fc_slot_table,
session->fc_attrs.max_reqs, 1);
if (status)
return status;
status = nfs4_reset_slot_table(&session->bc_slot_table,
session->bc_attrs.max_reqs, 0);
return status;
}
/* Destroy the slot table */ /* Destroy the slot table */
static void nfs4_destroy_slot_tables(struct nfs4_session *session) static void nfs4_destroy_slot_tables(struct nfs4_session *session)
{ {
...@@ -5083,29 +5066,35 @@ static int nfs4_init_slot_table(struct nfs4_slot_table *tbl, ...@@ -5083,29 +5066,35 @@ static int nfs4_init_slot_table(struct nfs4_slot_table *tbl,
} }
/* /*
* Initialize the forechannel and backchannel tables * Initialize or reset the forechannel and backchannel tables
*/ */
static int nfs4_init_slot_tables(struct nfs4_session *session) static int nfs4_setup_session_slot_tables(struct nfs4_session *ses)
{ {
struct nfs4_slot_table *tbl; struct nfs4_slot_table *tbl;
int status = 0; int status;
tbl = &session->fc_slot_table; dprintk("--> %s\n", __func__);
/* Fore channel */
tbl = &ses->fc_slot_table;
if (tbl->slots == NULL) { if (tbl->slots == NULL) {
status = nfs4_init_slot_table(tbl, status = nfs4_init_slot_table(tbl, ses->fc_attrs.max_reqs, 1);
session->fc_attrs.max_reqs, 1); if (status) /* -ENOMEM */
return status;
} else {
status = nfs4_reset_slot_table(tbl, ses->fc_attrs.max_reqs, 1);
if (status) if (status)
return status; return status;
} }
/* Back channel */
tbl = &session->bc_slot_table; tbl = &ses->bc_slot_table;
if (tbl->slots == NULL) { if (tbl->slots == NULL) {
status = nfs4_init_slot_table(tbl, status = nfs4_init_slot_table(tbl, ses->bc_attrs.max_reqs, 0);
session->bc_attrs.max_reqs, 0);
if (status) if (status)
nfs4_destroy_slot_tables(session); /* Fore and back channel share a connection so get
} * both slot tables or neither */
nfs4_destroy_slot_tables(ses);
} else
status = nfs4_reset_slot_table(tbl, ses->bc_attrs.max_reqs, 0);
return status; return status;
} }
...@@ -5293,13 +5282,9 @@ int nfs4_proc_create_session(struct nfs_client *clp) ...@@ -5293,13 +5282,9 @@ int nfs4_proc_create_session(struct nfs_client *clp)
if (status) if (status)
goto out; goto out;
/* Init and reset the fore channel */ /* Init or reset the session slot tables */
status = nfs4_init_slot_tables(session); status = nfs4_setup_session_slot_tables(session);
dprintk("slot table initialization returned %d\n", status); dprintk("slot table setup returned %d\n", status);
if (status)
goto out;
status = nfs4_reset_slot_tables(session);
dprintk("slot table reset returned %d\n", status);
if (status) if (status)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment