static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
{
+ struct nfs4_session *session;
struct nfs4_slot_table *tbl;
- tbl = &res->sr_session->fc_slot_table;
if (!res->sr_slot) {
/* just wake up the next guy waiting since
* we may have not consumed a slot after all */
dprintk("%s: No slot\n", __func__);
return;
}
+ tbl = res->sr_slot->table;
+ session = tbl->session;
spin_lock(&tbl->slot_tbl_lock);
nfs4_free_slot(tbl, res->sr_slot - tbl->slots);
- nfs4_check_drain_fc_complete(res->sr_session);
+ nfs4_check_drain_fc_complete(session);
spin_unlock(&tbl->slot_tbl_lock);
res->sr_slot = NULL;
}
static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res)
{
+ struct nfs4_session *session;
struct nfs4_slot *slot;
unsigned long timestamp;
struct nfs_client *clp;
goto out;
slot = res->sr_slot;
+ session = slot->table->session;
/* Check the SEQUENCE operation status */
switch (res->sr_status) {
/* Update the slot's sequence and clientid lease timer */
++slot->seq_nr;
timestamp = slot->renewal_time;
- clp = res->sr_session->clp;
+ clp = session->clp;
do_renew_lease(clp, timestamp);
/* Check sequence flags */
if (res->sr_status_flags != 0)
*/
dprintk("%s: slot=%td seq=%d: Operation in progress\n",
__func__,
- slot - res->sr_session->fc_slot_table.slots,
+ slot - session->fc_slot_table.slots,
slot->seq_nr);
goto out_retry;
default:
static int nfs4_sequence_done(struct rpc_task *task,
struct nfs4_sequence_res *res)
{
- if (res->sr_session == NULL)
+ if (res->sr_slot == NULL)
return 1;
return nfs41_sequence_done(task, res);
}
args->sa_cache_this = 0;
if (cache_reply)
args->sa_cache_this = 1;
- res->sr_session = NULL;
res->sr_slot = NULL;
}
dprintk("<-- %s slotid=%d seqid=%d\n", __func__, slotid, slot->seq_nr);
- res->sr_session = session;
res->sr_slot = slot;
res->sr_status_flags = 0;
/*
return status;
}
-struct nfs4_slot *nfs4_alloc_slots(u32 max_slots, gfp_t gfp_flags)
+struct nfs4_slot *nfs4_alloc_slots(struct nfs4_slot_table *table,
+ u32 max_slots, gfp_t gfp_flags)
{
- return kmalloc_array(max_slots, sizeof(struct nfs4_slot), gfp_flags);
+ struct nfs4_slot *tbl;
+ u32 i;
+
+ tbl = kmalloc_array(max_slots, sizeof(*tbl), gfp_flags);
+ if (tbl != NULL) {
+ for (i = 0; i < max_slots; i++)
+ tbl[i].table = table;
+ }
+ return tbl;
}
static void nfs4_add_and_init_slots(struct nfs4_slot_table *tbl,
/* Does the newly negotiated max_reqs match the existing slot table? */
if (max_reqs != tbl->max_slots) {
- new = nfs4_alloc_slots(max_reqs, GFP_NOFS);
+ new = nfs4_alloc_slots(tbl, max_reqs, GFP_NOFS);
if (!new)
goto out;
}
dprintk("--> %s\n", __func__);
/* Fore channel */
tbl = &ses->fc_slot_table;
+ tbl->session = ses;
status = nfs4_realloc_slot_table(tbl, ses->fc_attrs.max_reqs, 1);
if (status) /* -ENOMEM */
return status;
/* Back channel */
tbl = &ses->bc_slot_table;
+ tbl->session = ses;
status = nfs4_realloc_slot_table(tbl, ses->bc_attrs.max_reqs, 0);
if (status && tbl->slots == NULL)
/* Fore and back channel share a connection so get
struct rpc_rqst *rqstp)
{
#if defined(CONFIG_NFS_V4_1)
+ struct nfs4_session *session;
struct nfs4_sessionid id;
u32 dummy;
int status;
__be32 *p;
- if (!res->sr_session)
+ if (res->sr_slot == NULL)
return 0;
status = decode_op_hdr(xdr, OP_SEQUENCE);
* sequence number, the server is looney tunes.
*/
status = -EREMOTEIO;
+ session = res->sr_slot->table->session;
- if (memcmp(id.data, res->sr_session->sess_id.data,
+ if (memcmp(id.data, session->sess_id.data,
NFS4_MAX_SESSIONID_LEN)) {
dprintk("%s Invalid session id\n", __func__);
goto out_err;
}
/* slot id */
dummy = be32_to_cpup(p++);
- if (dummy != res->sr_slot - res->sr_session->fc_slot_table.slots) {
+ if (dummy != res->sr_slot - session->fc_slot_table.slots) {
dprintk("%s Invalid slot id\n", __func__);
goto out_err;
}