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

Commit 4f7cdf18 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

NFSv4: The state manager shouldn't exit on errors that were handled



nfs4_recovery_handle_error() will correctly handle errors such as
NFS4ERR_CB_PATH_DOWN, however because they are still passed back to the
main loop in nfs4_state_manager(), they can cause the latter to exit
prematurely.

Fix this by letting nfs4_recovery_handle_error() change the error value in
cases where there is no action required by the caller.

Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent e345e88a
Loading
Loading
Loading
Loading
+5 −6
Original line number Original line Diff line number Diff line
@@ -1051,12 +1051,12 @@ static void nfs4_state_end_reclaim_nograce(struct nfs_client *clp)
	clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state);
	clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state);
}
}


static void nfs4_recovery_handle_error(struct nfs_client *clp, int error)
static int nfs4_recovery_handle_error(struct nfs_client *clp, int error)
{
{
	switch (error) {
	switch (error) {
		case -NFS4ERR_CB_PATH_DOWN:
		case -NFS4ERR_CB_PATH_DOWN:
			nfs_handle_cb_pathdown(clp);
			nfs_handle_cb_pathdown(clp);
			break;
			return 0;
		case -NFS4ERR_STALE_CLIENTID:
		case -NFS4ERR_STALE_CLIENTID:
		case -NFS4ERR_LEASE_MOVED:
		case -NFS4ERR_LEASE_MOVED:
			set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
			set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
@@ -1075,6 +1075,7 @@ static void nfs4_recovery_handle_error(struct nfs_client *clp, int error)
		case -NFS4ERR_SEQ_MISORDERED:
		case -NFS4ERR_SEQ_MISORDERED:
			set_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state);
			set_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state);
	}
	}
	return error;
}
}


static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recovery_ops *ops)
static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recovery_ops *ops)
@@ -1094,8 +1095,7 @@ static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recov
		if (status < 0) {
		if (status < 0) {
			set_bit(ops->owner_flag_bit, &sp->so_flags);
			set_bit(ops->owner_flag_bit, &sp->so_flags);
			nfs4_put_state_owner(sp);
			nfs4_put_state_owner(sp);
			nfs4_recovery_handle_error(clp, status);
			return nfs4_recovery_handle_error(clp, status);
			return status;
		}
		}
		nfs4_put_state_owner(sp);
		nfs4_put_state_owner(sp);
		goto restart;
		goto restart;
@@ -1125,8 +1125,7 @@ static int nfs4_check_lease(struct nfs_client *clp)
	status = ops->renew_lease(clp, cred);
	status = ops->renew_lease(clp, cred);
	put_rpccred(cred);
	put_rpccred(cred);
out:
out:
	nfs4_recovery_handle_error(clp, status);
	return nfs4_recovery_handle_error(clp, status);
	return status;
}
}


static int nfs4_reclaim_lease(struct nfs_client *clp)
static int nfs4_reclaim_lease(struct nfs_client *clp)