NFSv4: Add debugging printks to state manager
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 28 May 2012 19:12:27 +0000 (15:12 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 28 May 2012 21:21:57 +0000 (17:21 -0400)
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4state.c

index dfedde6f2a7101bad30779a309f4a3f05ed1b607..c679b9ecef634c80d4738e3cc2a9624f51c327c2 100644 (file)
@@ -1108,6 +1108,8 @@ void nfs4_schedule_lease_recovery(struct nfs_client *clp)
                return;
        if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
                set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
+       dprintk("%s: scheduling lease recovery for server %s\n", __func__,
+                       clp->cl_hostname);
        nfs4_schedule_state_manager(clp);
 }
 EXPORT_SYMBOL_GPL(nfs4_schedule_lease_recovery);
@@ -1124,6 +1126,8 @@ static void nfs40_handle_cb_pathdown(struct nfs_client *clp)
 {
        set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
        nfs_expire_all_delegations(clp);
+       dprintk("%s: handling CB_PATHDOWN recovery for server %s\n", __func__,
+                       clp->cl_hostname);
 }
 
 void nfs4_schedule_path_down_recovery(struct nfs_client *clp)
@@ -1160,6 +1164,8 @@ void nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4
        struct nfs_client *clp = server->nfs_client;
 
        nfs4_state_mark_reclaim_nograce(clp, state);
+       dprintk("%s: scheduling stateid recovery for server %s\n", __func__,
+                       clp->cl_hostname);
        nfs4_schedule_state_manager(clp);
 }
 EXPORT_SYMBOL_GPL(nfs4_schedule_stateid_recovery);
@@ -1506,8 +1512,12 @@ static int nfs4_recovery_handle_error(struct nfs_client *clp, int error)
                        nfs4_warn_keyexpired(clp->cl_hostname);
                        break;
                default:
+                       dprintk("%s: failed to handle error %d for server %s\n",
+                                       __func__, error, clp->cl_hostname);
                        return error;
        }
+       dprintk("%s: handled error %d for server %s\n", __func__, error,
+                       clp->cl_hostname);
        return 0;
 }
 
@@ -1605,15 +1615,21 @@ static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status)
        case -NFS4ERR_MINOR_VERS_MISMATCH:
                if (clp->cl_cons_state == NFS_CS_SESSION_INITING)
                        nfs_mark_client_ready(clp, -EPROTONOSUPPORT);
+               dprintk("%s: exit with error %d for server %s\n",
+                               __func__, -EPROTONOSUPPORT, clp->cl_hostname);
                return -EPROTONOSUPPORT;
        case -EKEYEXPIRED:
                nfs4_warn_keyexpired(clp->cl_hostname);
        case -NFS4ERR_NOT_SAME: /* FixMe: implement recovery
                                 * in nfs4_exchange_id */
        default:
+               dprintk("%s: exit with error %d for server %s\n", __func__,
+                               status, clp->cl_hostname);
                return status;
        }
        set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
+       dprintk("%s: handled error %d for server %s\n", __func__, status,
+                       clp->cl_hostname);
        return 0;
 }
 
@@ -1653,6 +1669,8 @@ EXPORT_SYMBOL_GPL(nfs4_schedule_session_recovery);
 void nfs41_handle_recall_slot(struct nfs_client *clp)
 {
        set_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state);
+       dprintk("%s: scheduling slot recall for server %s\n", __func__,
+                       clp->cl_hostname);
        nfs4_schedule_state_manager(clp);
 }
 
@@ -1662,6 +1680,8 @@ static void nfs4_reset_all_state(struct nfs_client *clp)
                set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state);
                clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
                nfs4_state_start_reclaim_nograce(clp);
+               dprintk("%s: scheduling reset of all state for server %s!\n",
+                               __func__, clp->cl_hostname);
                nfs4_schedule_state_manager(clp);
        }
 }
@@ -1670,6 +1690,8 @@ static void nfs41_handle_server_reboot(struct nfs_client *clp)
 {
        if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) {
                nfs4_state_start_reclaim_reboot(clp);
+               dprintk("%s: server %s rebooted!\n", __func__,
+                               clp->cl_hostname);
                nfs4_schedule_state_manager(clp);
        }
 }
@@ -1677,12 +1699,15 @@ static void nfs41_handle_server_reboot(struct nfs_client *clp)
 static void nfs41_handle_state_revoked(struct nfs_client *clp)
 {
        nfs4_reset_all_state(clp);
+       dprintk("%s: state revoked on server %s\n", __func__, clp->cl_hostname);
 }
 
 static void nfs41_handle_recallable_state_revoked(struct nfs_client *clp)
 {
        /* This will need to handle layouts too */
        nfs_expire_all_delegations(clp);
+       dprintk("%s: Recallable state revoked on server %s!\n", __func__,
+                       clp->cl_hostname);
 }
 
 static void nfs41_handle_backchannel_fault(struct nfs_client *clp)
@@ -1690,6 +1715,8 @@ static void nfs41_handle_backchannel_fault(struct nfs_client *clp)
        nfs_expire_all_delegations(clp);
        if (test_and_set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) == 0)
                nfs4_schedule_state_manager(clp);
+       dprintk("%s: server %s declared a backchannel fault\n", __func__,
+                       clp->cl_hostname);
 }
 
 static void nfs41_handle_cb_path_down(struct nfs_client *clp)
@@ -1740,6 +1767,8 @@ static int nfs4_reset_session(struct nfs_client *clp)
        memset(clp->cl_session->sess_id.data, 0, NFS4_MAX_SESSIONID_LEN);
        status = nfs4_proc_create_session(clp, cred);
        if (status) {
+               dprintk("%s: session reset failed with status %d for server %s!\n",
+                       __func__, status, clp->cl_hostname);
                status = nfs4_handle_reclaim_lease_error(clp, status);
                goto out;
        }
@@ -1747,6 +1776,8 @@ static int nfs4_reset_session(struct nfs_client *clp)
        /* create_session negotiated new slot table */
        clear_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state);
        clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);
+       dprintk("%s: session reset was successful for server %s!\n",
+                       __func__, clp->cl_hostname);
 
         /* Let the state manager reestablish state */
        if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
@@ -1798,6 +1829,8 @@ static int nfs4_bind_conn_to_session(struct nfs_client *clp)
        clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);
        switch (ret) {
        case 0:
+               dprintk("%s: bind_conn_to_session was successful for server %s!\n",
+                       __func__, clp->cl_hostname);
                break;
        case -NFS4ERR_DELAY:
                ssleep(1);