rpc: rebind back channel on reconnect

after reestablishing an rpc connection, send BIND_CONN_TO_SESSION if we need a back channel

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2011-01-05 11:54:06 -05:00
parent 9c59af4da5
commit 9c960aa409
2 changed files with 13 additions and 1 deletions

View file

@ -115,6 +115,7 @@ typedef struct __nfs41_rpc_clnt {
uint32_t version; uint32_t version;
bool_t is_valid_session; bool_t is_valid_session;
bool_t in_recovery; bool_t in_recovery;
bool_t needcb;
} nfs41_rpc_clnt; } nfs41_rpc_clnt;
struct client_state { struct client_state {

View file

@ -21,7 +21,7 @@
* such damages. * such damages.
*/ */
#include "nfs41.h" #include "nfs41_ops.h"
#include "daemon_debug.h" #include "daemon_debug.h"
#include "nfs41_xdr.h" #include "nfs41_xdr.h"
#include "nfs41_callback.h" #include "nfs41_callback.h"
@ -133,6 +133,7 @@ int nfs41_rpc_clnt_create(
status = GetLastError(); status = GetLastError();
goto out; goto out;
} }
rpc->needcb = needcb;
rpc->cond = CreateEvent(NULL, TRUE, FALSE, "rpc_recovery_cond"); rpc->cond = CreateEvent(NULL, TRUE, FALSE, "rpc_recovery_cond");
if (rpc->cond == NULL) { if (rpc->cond == NULL) {
status = GetLastError(); status = GetLastError();
@ -282,6 +283,16 @@ static int rpc_reconnect(
out_unlock: out_unlock:
ReleaseSRWLockExclusive(&rpc->lock); ReleaseSRWLockExclusive(&rpc->lock);
/* after releasing the rpc lock, send a BIND_CONN_TO_SESSION if
* we need to associate the connection with the backchannel */
if (status == NO_ERROR && rpc->needcb) {
status = nfs41_bind_conn_to_session(rpc,
rpc->client->session->session_id, CDFC4_BACK_OR_BOTH);
if (status)
eprintf("nfs41_bind_conn_to_session() failed with %s\n",
nfs_error_string(status));
}
return status; return status;
out_err_client: out_err_client: