nfs4.1: add BIND_CONN_TO_SESSION operation
This patch adds the BIND_CONN_TO_SESSION operation which is needed for upcoming SP4_MACH_CRED work and useful for recovering from broken connections without destroying the session. Signed-off-by: Weston Andros Adamson <dros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:

committed by
Trond Myklebust

parent
d23d61c8d3
commit
7c44f1ae4a
@@ -5099,6 +5099,60 @@ nfs41_same_server_scope(struct nfs41_server_scope *a,
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* nfs4_proc_bind_conn_to_session()
|
||||
*
|
||||
* The 4.1 client currently uses the same TCP connection for the
|
||||
* fore and backchannel.
|
||||
*/
|
||||
int nfs4_proc_bind_conn_to_session(struct nfs_client *clp)
|
||||
{
|
||||
int status;
|
||||
struct nfs41_bind_conn_to_session_res res;
|
||||
struct rpc_message msg = {
|
||||
.rpc_proc =
|
||||
&nfs4_procedures[NFSPROC4_CLNT_BIND_CONN_TO_SESSION],
|
||||
.rpc_argp = clp,
|
||||
.rpc_resp = &res,
|
||||
};
|
||||
|
||||
dprintk("--> %s\n", __func__);
|
||||
BUG_ON(clp == NULL);
|
||||
|
||||
res.session = kzalloc(sizeof(struct nfs4_session), GFP_NOFS);
|
||||
if (unlikely(res.session == NULL)) {
|
||||
status = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
|
||||
if (status == 0) {
|
||||
if (memcmp(res.session->sess_id.data,
|
||||
clp->cl_session->sess_id.data, NFS4_MAX_SESSIONID_LEN)) {
|
||||
dprintk("NFS: %s: Session ID mismatch\n", __func__);
|
||||
status = -EIO;
|
||||
goto out_session;
|
||||
}
|
||||
if (res.dir != NFS4_CDFS4_BOTH) {
|
||||
dprintk("NFS: %s: Unexpected direction from server\n",
|
||||
__func__);
|
||||
status = -EIO;
|
||||
goto out_session;
|
||||
}
|
||||
if (res.use_conn_in_rdma_mode) {
|
||||
dprintk("NFS: %s: Server returned RDMA mode = true\n",
|
||||
__func__);
|
||||
status = -EIO;
|
||||
goto out_session;
|
||||
}
|
||||
}
|
||||
out_session:
|
||||
kfree(res.session);
|
||||
out:
|
||||
dprintk("<-- %s status= %d\n", __func__, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* nfs4_proc_exchange_id()
|
||||
*
|
||||
|
Reference in New Issue
Block a user