Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 175986
b: refs/heads/master
c: 9dfdf40
h: refs/heads/master
v: v3
  • Loading branch information
Ricardo Labiaga authored and Trond Myklebust committed Dec 6, 2009
1 parent 701c572 commit 91f30a2
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9430fb6b5315f7bc94b05be915c64ebfefc55bbc
refs/heads/master: 9dfdf404c99347e2e224e25f8626e7b6399a05cd
2 changes: 2 additions & 0 deletions trunk/fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4586,10 +4586,12 @@ struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp)
init_completion(&session->complete);

tbl = &session->fc_slot_table;
tbl->highest_used_slotid = -1;
spin_lock_init(&tbl->slot_tbl_lock);
rpc_init_wait_queue(&tbl->slot_tbl_waitq, "ForeChannel Slot table");

tbl = &session->bc_slot_table;
tbl->highest_used_slotid = -1;
spin_lock_init(&tbl->slot_tbl_lock);
rpc_init_wait_queue(&tbl->slot_tbl_waitq, "BackChannel Slot table");

Expand Down
59 changes: 41 additions & 18 deletions trunk/fs/nfs/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,43 @@ static int nfs41_setup_state_renewal(struct nfs_client *clp)
return status;
}

static void nfs41_end_drain_session(struct nfs_client *clp,
struct nfs4_session *ses)
{
if (test_and_clear_bit(NFS4CLNT_SESSION_DRAINING, &clp->cl_state))
rpc_wake_up(&ses->fc_slot_table.slot_tbl_waitq);
}

static int nfs41_begin_drain_session(struct nfs_client *clp,
struct nfs4_session *ses)
{
struct nfs4_slot_table *tbl = &ses->fc_slot_table;

spin_lock(&tbl->slot_tbl_lock);
set_bit(NFS4CLNT_SESSION_DRAINING, &clp->cl_state);
if (tbl->highest_used_slotid != -1) {
INIT_COMPLETION(ses->complete);
spin_unlock(&tbl->slot_tbl_lock);
return wait_for_completion_interruptible(&ses->complete);
}
spin_unlock(&tbl->slot_tbl_lock);
return 0;
}

int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred)
{
int status;

status = nfs41_begin_drain_session(clp, clp->cl_session);
if (status != 0)
goto out;
status = nfs4_proc_exchange_id(clp, cred);
if (status != 0)
goto out;
status = nfs4_proc_create_session(clp);
if (status != 0)
goto out;
nfs41_end_drain_session(clp, clp->cl_session);
nfs41_setup_state_renewal(clp);
nfs_mark_client_ready(clp, NFS_CS_READY);
out:
Expand Down Expand Up @@ -1239,20 +1266,11 @@ static void nfs4_session_recovery_handle_error(struct nfs_client *clp, int err)
static int nfs4_reset_session(struct nfs_client *clp)
{
struct nfs4_session *ses = clp->cl_session;
struct nfs4_slot_table *tbl = &ses->fc_slot_table;
int status;

spin_lock(&tbl->slot_tbl_lock);
set_bit(NFS4CLNT_SESSION_DRAINING, &clp->cl_state);
if (tbl->highest_used_slotid != -1) {
INIT_COMPLETION(ses->complete);
spin_unlock(&tbl->slot_tbl_lock);
status = wait_for_completion_interruptible(&ses->complete);
if (status) /* -ERESTARTSYS */
goto out;
} else {
spin_unlock(&tbl->slot_tbl_lock);
}
status = nfs41_begin_drain_session(clp, ses);
if (status != 0)
return status;

status = nfs4_proc_destroy_session(clp->cl_session);
if (status && status != -NFS4ERR_BADSESSION &&
Expand All @@ -1265,13 +1283,18 @@ static int nfs4_reset_session(struct nfs_client *clp)
status = nfs4_proc_create_session(clp);
if (status)
nfs4_session_recovery_handle_error(clp, status);
/* fall through*/

out:
/* Wake up the next rpc task even on error */
clear_bit(NFS4CLNT_SESSION_DRAINING, &clp->cl_state);
rpc_wake_up(&clp->cl_session->fc_slot_table.slot_tbl_waitq);
if (status == 0)
nfs41_setup_state_renewal(clp);
/*
* Let the state manager reestablish state
* without waking other tasks yet.
*/
if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) {
/* Wake up the next rpc task */
nfs41_end_drain_session(clp, ses);
if (status == 0)
nfs41_setup_state_renewal(clp);
}
return status;
}

Expand Down

0 comments on commit 91f30a2

Please sign in to comment.