Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9e64442 authored by Weston Andros Adamson's avatar Weston Andros Adamson Committed by Trond Myklebust
Browse files

nfs41: Use BIND_CONN_TO_SESSION for CB_PATH_DOWN*



The state manager can handle SEQ4_STATUS_CB_PATH_DOWN* flags with a
BIND_CONN_TO_SESSION instead of destroying the session and creating a new one.

Signed-off-by: default avatarWeston Andros Adamson <dros@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 7c44f1ae
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ enum nfs4_client_state {
	NFS4CLNT_LEASE_CONFIRM,
	NFS4CLNT_LEASE_CONFIRM,
	NFS4CLNT_SERVER_SCOPE_MISMATCH,
	NFS4CLNT_SERVER_SCOPE_MISMATCH,
	NFS4CLNT_PURGE_STATE,
	NFS4CLNT_PURGE_STATE,
	NFS4CLNT_BIND_CONN_TO_SESSION,
};
};


enum nfs4_session_state {
enum nfs4_session_state {
+30 −4
Original line number Original line Diff line number Diff line
@@ -1640,13 +1640,20 @@ static void nfs41_handle_recallable_state_revoked(struct nfs_client *clp)
	nfs_expire_all_delegations(clp);
	nfs_expire_all_delegations(clp);
}
}


static void nfs41_handle_cb_path_down(struct nfs_client *clp)
static void nfs41_handle_backchannel_fault(struct nfs_client *clp)
{
{
	nfs_expire_all_delegations(clp);
	nfs_expire_all_delegations(clp);
	if (test_and_set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) == 0)
	if (test_and_set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) == 0)
		nfs4_schedule_state_manager(clp);
		nfs4_schedule_state_manager(clp);
}
}


static void nfs41_handle_cb_path_down(struct nfs_client *clp)
{
	if (test_and_set_bit(NFS4CLNT_BIND_CONN_TO_SESSION,
		&clp->cl_state) == 0)
		nfs4_schedule_state_manager(clp);
}

void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags)
void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags)
{
{
	if (!flags)
	if (!flags)
@@ -1664,8 +1671,9 @@ void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags)
		nfs41_handle_state_revoked(clp);
		nfs41_handle_state_revoked(clp);
	if (flags & SEQ4_STATUS_RECALLABLE_STATE_REVOKED)
	if (flags & SEQ4_STATUS_RECALLABLE_STATE_REVOKED)
		nfs41_handle_recallable_state_revoked(clp);
		nfs41_handle_recallable_state_revoked(clp);
	if (flags & (SEQ4_STATUS_CB_PATH_DOWN |
	if (flags & SEQ4_STATUS_BACKCHANNEL_FAULT)
			    SEQ4_STATUS_BACKCHANNEL_FAULT |
		nfs41_handle_backchannel_fault(clp);
	else if (flags & (SEQ4_STATUS_CB_PATH_DOWN |
				SEQ4_STATUS_CB_PATH_DOWN_SESSION))
				SEQ4_STATUS_CB_PATH_DOWN_SESSION))
		nfs41_handle_cb_path_down(clp);
		nfs41_handle_cb_path_down(clp);
}
}
@@ -1691,6 +1699,7 @@ static int nfs4_reset_session(struct nfs_client *clp)
	clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
	clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
	/* create_session negotiated new slot table */
	/* create_session negotiated new slot table */
	clear_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state);
	clear_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state);
	clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state);


	 /* Let the state manager reestablish state */
	 /* Let the state manager reestablish state */
	if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
	if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
@@ -1727,10 +1736,19 @@ static int nfs4_recall_slot(struct nfs_client *clp)
	return 0;
	return 0;
}
}


static int nfs4_bind_conn_to_session(struct nfs_client *clp)
{
	return nfs4_proc_bind_conn_to_session(clp);
}
#else /* CONFIG_NFS_V4_1 */
#else /* CONFIG_NFS_V4_1 */
static int nfs4_reset_session(struct nfs_client *clp) { return 0; }
static int nfs4_reset_session(struct nfs_client *clp) { return 0; }
static int nfs4_end_drain_session(struct nfs_client *clp) { return 0; }
static int nfs4_end_drain_session(struct nfs_client *clp) { return 0; }
static int nfs4_recall_slot(struct nfs_client *clp) { return 0; }
static int nfs4_recall_slot(struct nfs_client *clp) { return 0; }

static int nfs4_bind_conn_to_session(struct nfs_client *clp)
{
	return 0;
}
#endif /* CONFIG_NFS_V4_1 */
#endif /* CONFIG_NFS_V4_1 */


/* Set NFS4CLNT_LEASE_EXPIRED for all v4.0 errors and for recoverable errors
/* Set NFS4CLNT_LEASE_EXPIRED for all v4.0 errors and for recoverable errors
@@ -1814,6 +1832,14 @@ static void nfs4_state_manager(struct nfs_client *clp)
				goto out_error;
				goto out_error;
		}
		}


		/* Send BIND_CONN_TO_SESSION */
		if (test_and_clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION,
				&clp->cl_state) && nfs4_has_session(clp)) {
			status = nfs4_bind_conn_to_session(clp);
			if (status < 0)
				goto out_error;
		}

		/* First recover reboot state... */
		/* First recover reboot state... */
		if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) {
		if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) {
			status = nfs4_do_reclaim(clp,
			status = nfs4_do_reclaim(clp,