NFS add session back channel draining

Currently session draining only drains the fore channel.
The back channel processing must also be drained.

Use the back channel highest_slot_used to indicate that a callback is being
processed by the callback thread.  Move the session complete to be per channel.

When the session is draininig, wait for any current back channel processing
to complete and stop all new back channel processing by returning NFS4ERR_DELAY
to the back channel client.

Drain the back channel, then the fore channel.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Andy Adamson
2011-01-06 02:04:34 +00:00
committed by Trond Myklebust
parent ece0de633c
commit 42acd02182
6 changed files with 86 additions and 16 deletions

View File

@@ -596,6 +596,37 @@ preprocess_nfs41_op(int nop, unsigned int op_nr, struct callback_op **op)
return htonl(NFS_OK);
}
static void nfs4_callback_free_slot(struct nfs4_session *session)
{
struct nfs4_slot_table *tbl = &session->bc_slot_table;
spin_lock(&tbl->slot_tbl_lock);
/*
* Let the state manager know callback processing done.
* A single slot, so highest used slotid is either 0 or -1
*/
tbl->highest_used_slotid--;
nfs4_check_drain_bc_complete(session);
spin_unlock(&tbl->slot_tbl_lock);
}
static void nfs4_cb_free_slot(struct nfs_client *clp)
{
if (clp && clp->cl_session)
nfs4_callback_free_slot(clp->cl_session);
}
/* A single slot, so highest used slotid is either 0 or -1 */
void nfs4_cb_take_slot(struct nfs_client *clp)
{
struct nfs4_slot_table *tbl = &clp->cl_session->bc_slot_table;
spin_lock(&tbl->slot_tbl_lock);
tbl->highest_used_slotid++;
BUG_ON(tbl->highest_used_slotid != 0);
spin_unlock(&tbl->slot_tbl_lock);
}
#else /* CONFIG_NFS_V4_1 */
static __be32
@@ -604,6 +635,9 @@ preprocess_nfs41_op(int nop, unsigned int op_nr, struct callback_op **op)
return htonl(NFS4ERR_MINOR_VERS_MISMATCH);
}
static void nfs4_cb_free_slot(struct nfs_client *clp)
{
}
#endif /* CONFIG_NFS_V4_1 */
static __be32
@@ -724,6 +758,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
*hdr_res.status = status;
*hdr_res.nops = htonl(nops);
nfs4_cb_free_slot(cps.clp);
nfs_put_client(cps.clp);
dprintk("%s: done, status = %u\n", __func__, ntohl(status));
return rpc_success;