No subject


Thu Apr 24 11:39:44 EDT 2008


therefore it is never expected to be NULL.

Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfs/nfs4proc.c  |   12 ++----------
 fs/nfs/nfs4state.c |    7 ++-----
 2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 4b30f98..e642390 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4345,16 +4345,8 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
 			put_rpccred(clp->cl_ex_cred);
 		}
 
-		if (cred)
-			get_rpccred(cred);
-		else {
-			cred = nfs4_get_machine_cred(clp);
-			if (!cred) {
-				struct rpc_clnt *clnt = clp->cl_rpcclient;
-				cred = rpcauth_lookupcred(clnt->cl_auth, 0);
-			}
-		}
-		clp->cl_ex_cred = cred;
+		BUG_ON(cred == NULL);
+		clp->cl_ex_cred = get_rpccred(cred);
 		dprintk("%s set cl_ex_cred %p\n", __func__, clp->cl_ex_cred);
 	}
 
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 6602615..134b897 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -64,10 +64,7 @@ static LIST_HEAD(nfs4_clientid_list);
 
 int nfs4_init_clientid(struct nfs_client *clp, struct rpc_cred *cred)
 {
-	int status = -ENOENT;
-	if (cred == NULL)
-		goto out;
-	status = nfs4_proc_setclientid(clp, NFS4_CALLBACK,
+	int status = nfs4_proc_setclientid(clp, NFS4_CALLBACK,
 			nfs_callback_tcpport, cred);
 	if (status == 0)
 		status = nfs4_proc_setclientid_confirm(clp, cred);
@@ -1011,8 +1008,8 @@ restart_loop:
 	status = -ENOENT;
 	cred = nfs4_get_setclientid_cred(clp);
 	dprintk("%s: setclientid_cred %p\n", __func__, cred);
-	status = ops->establish_clid(clp, cred);
 	if (cred) {
+		status = ops->establish_clid(clp, cred);
 		put_rpccred(cred);
 		/* Handle case where the user hasn't set up machine creds */
 		if (status == -EACCES && cred == clp->cl_machine_cred) {
-- 
1.5.3.3



More information about the pNFS mailing list