Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec
[linux-2.6-block.git] / fs / nfsd / nfs4callback.c
index 1f04d2a70d257c436960abbdb0eef2ee0648cadf..601bf33c26a0bbdc036bb7b2a195fc07ccfc7fe8 100644 (file)
@@ -746,30 +746,17 @@ static int max_cb_time(struct net *net)
        return max(nn->nfsd4_lease/10, (time_t)1) * HZ;
 }
 
-static struct rpc_cred *callback_cred;
-
-int set_callback_cred(void)
-{
-       if (callback_cred)
-               return 0;
-       callback_cred = rpc_lookup_machine_cred("nfs");
-       if (!callback_cred)
-               return -ENOMEM;
-       return 0;
-}
-
-void cleanup_callback_cred(void)
-{
-       if (callback_cred) {
-               put_rpccred(callback_cred);
-               callback_cred = NULL;
-       }
-}
-
 static struct rpc_cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc_clnt *client, struct nfsd4_session *ses)
 {
        if (clp->cl_minorversion == 0) {
-               return get_rpccred(callback_cred);
+               char *principal = clp->cl_cred.cr_targ_princ ?
+                                       clp->cl_cred.cr_targ_princ : "nfs";
+               struct rpc_cred *cred;
+
+               cred = rpc_lookup_machine_cred(principal);
+               if (!IS_ERR(cred))
+                       get_rpccred(cred);
+               return cred;
        } else {
                struct rpc_auth *auth = client->cl_auth;
                struct auth_cred acred = {};
@@ -980,6 +967,7 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
                break;
        case -ESERVERFAULT:
                ++session->se_cb_seq_nr;
+               /* Fall through */
        case 1:
        case -NFS4ERR_BADSESSION:
                nfsd4_mark_cb_fault(cb->cb_clp, cb->cb_seq_status);