aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-05-25 17:51:23 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-05-25 18:02:09 -0400
commit848f5bda54ef19435ff78f124082bf6eff2ab620 (patch)
tree06b86b2725e1c1c309067cb7c3bd7b16058662e9 /fs/nfs/nfs4proc.c
parentad24ecfbcddfa88541bccc980e753aeda8bf4031 (diff)
NFSv4.1: Ensure we use the correct credentials for session create/destroy
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index f8817e81096e..8fa3a36df185 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5480,8 +5480,12 @@ struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp)
5480void nfs4_destroy_session(struct nfs4_session *session) 5480void nfs4_destroy_session(struct nfs4_session *session)
5481{ 5481{
5482 struct rpc_xprt *xprt; 5482 struct rpc_xprt *xprt;
5483 struct rpc_cred *cred;
5483 5484
5484 nfs4_proc_destroy_session(session); 5485 cred = nfs4_get_exchange_id_cred(session->clp);
5486 nfs4_proc_destroy_session(session, cred);
5487 if (cred)
5488 put_rpccred(cred);
5485 5489
5486 rcu_read_lock(); 5490 rcu_read_lock();
5487 xprt = rcu_dereference(session->clp->cl_rpcclient->cl_xprt); 5491 xprt = rcu_dereference(session->clp->cl_rpcclient->cl_xprt);
@@ -5591,7 +5595,8 @@ static int nfs4_verify_channel_attrs(struct nfs41_create_session_args *args,
5591 return nfs4_verify_back_channel_attrs(args, session); 5595 return nfs4_verify_back_channel_attrs(args, session);
5592} 5596}
5593 5597
5594static int _nfs4_proc_create_session(struct nfs_client *clp) 5598static int _nfs4_proc_create_session(struct nfs_client *clp,
5599 struct rpc_cred *cred)
5595{ 5600{
5596 struct nfs4_session *session = clp->cl_session; 5601 struct nfs4_session *session = clp->cl_session;
5597 struct nfs41_create_session_args args = { 5602 struct nfs41_create_session_args args = {
@@ -5605,6 +5610,7 @@ static int _nfs4_proc_create_session(struct nfs_client *clp)
5605 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CREATE_SESSION], 5610 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CREATE_SESSION],
5606 .rpc_argp = &args, 5611 .rpc_argp = &args,
5607 .rpc_resp = &res, 5612 .rpc_resp = &res,
5613 .rpc_cred = cred,
5608 }; 5614 };
5609 int status; 5615 int status;
5610 5616
@@ -5629,7 +5635,7 @@ static int _nfs4_proc_create_session(struct nfs_client *clp)
5629 * It is the responsibility of the caller to verify the session is 5635 * It is the responsibility of the caller to verify the session is
5630 * expired before calling this routine. 5636 * expired before calling this routine.
5631 */ 5637 */
5632int nfs4_proc_create_session(struct nfs_client *clp) 5638int nfs4_proc_create_session(struct nfs_client *clp, struct rpc_cred *cred)
5633{ 5639{
5634 int status; 5640 int status;
5635 unsigned *ptr; 5641 unsigned *ptr;
@@ -5637,7 +5643,7 @@ int nfs4_proc_create_session(struct nfs_client *clp)
5637 5643
5638 dprintk("--> %s clp=%p session=%p\n", __func__, clp, session); 5644 dprintk("--> %s clp=%p session=%p\n", __func__, clp, session);
5639 5645
5640 status = _nfs4_proc_create_session(clp); 5646 status = _nfs4_proc_create_session(clp, cred);
5641 if (status) 5647 if (status)
5642 goto out; 5648 goto out;
5643 5649
@@ -5659,10 +5665,15 @@ out:
5659 * Issue the over-the-wire RPC DESTROY_SESSION. 5665 * Issue the over-the-wire RPC DESTROY_SESSION.
5660 * The caller must serialize access to this routine. 5666 * The caller must serialize access to this routine.
5661 */ 5667 */
5662int nfs4_proc_destroy_session(struct nfs4_session *session) 5668int nfs4_proc_destroy_session(struct nfs4_session *session,
5669 struct rpc_cred *cred)
5663{ 5670{
5671 struct rpc_message msg = {
5672 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_DESTROY_SESSION],
5673 .rpc_argp = session,
5674 .rpc_cred = cred,
5675 };
5664 int status = 0; 5676 int status = 0;
5665 struct rpc_message msg;
5666 5677
5667 dprintk("--> nfs4_proc_destroy_session\n"); 5678 dprintk("--> nfs4_proc_destroy_session\n");
5668 5679
@@ -5670,10 +5681,6 @@ int nfs4_proc_destroy_session(struct nfs4_session *session)
5670 if (session->clp->cl_cons_state != NFS_CS_READY) 5681 if (session->clp->cl_cons_state != NFS_CS_READY)
5671 return status; 5682 return status;
5672 5683
5673 msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_DESTROY_SESSION];
5674 msg.rpc_argp = session;
5675 msg.rpc_resp = NULL;
5676 msg.rpc_cred = NULL;
5677 status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); 5684 status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
5678 5685
5679 if (status) 5686 if (status)