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

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

NFSv4: Don't error if we handled it in nfs4_recovery_handle_error



If we handled an error condition, then nfs4_recovery_handle_error should
return '0' so that the state recovery thread can continue.
Also ensure that nfs4_check_lease() continues to abort if we haven't got
any credentials by having it return ENOKEY (which is not handled).

Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent c25573b5
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -1350,12 +1350,14 @@ static void nfs4_warn_keyexpired(const char *s)
static int nfs4_recovery_handle_error(struct nfs_client *clp, int error)
{
	switch (error) {
		case 0:
			break;
		case -NFS4ERR_CB_PATH_DOWN:
			nfs_handle_cb_pathdown(clp);
			return 0;
			break;
		case -NFS4ERR_NO_GRACE:
			nfs4_state_end_reclaim_reboot(clp);
			return 0;
			break;
		case -NFS4ERR_STALE_CLIENTID:
		case -NFS4ERR_LEASE_MOVED:
			set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
@@ -1375,14 +1377,16 @@ static int nfs4_recovery_handle_error(struct nfs_client *clp, int error)
		case -NFS4ERR_SEQ_MISORDERED:
			set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
			/* Zero session reset errors */
			return 0;
			break;
		case -EKEYEXPIRED:
			/* Nothing we can do */
			nfs4_warn_keyexpired(clp->cl_hostname);
			return 0;
	}
			break;
		default:
			return error;
	}
	return 0;
}

static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recovery_ops *ops)
{
@@ -1428,7 +1432,7 @@ static int nfs4_check_lease(struct nfs_client *clp)
	struct rpc_cred *cred;
	const struct nfs4_state_maintenance_ops *ops =
		clp->cl_mvops->state_renewal_ops;
	int status = -NFS4ERR_EXPIRED;
	int status;

	/* Is the client already known to have an expired lease? */
	if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
@@ -1438,6 +1442,7 @@ static int nfs4_check_lease(struct nfs_client *clp)
	spin_unlock(&clp->cl_lock);
	if (cred == NULL) {
		cred = nfs4_get_setclientid_cred(clp);
		status = -ENOKEY;
		if (cred == NULL)
			goto out;
	}
@@ -1662,10 +1667,10 @@ static void nfs4_state_manager(struct nfs_client *clp)

		if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
			status = nfs4_check_lease(clp);
			if (status < 0)
				goto out_error;
			if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
				continue;
			if (status < 0 && status != -NFS4ERR_CB_PATH_DOWN)
				goto out_error;
		}

		/* Initialize or reset the session */