Commit 1805e6b2 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

NFSv4/pnfs: If the server is down, retry the layout returns on reboot



If a layout return is embedded in a CLOSE or DELEGRETURN rpc call, and
the metadata server reboots, the expectation now is that the client
should resend the layout return once the server comes back up.
This patch changes the current behaviour of dropping the layouts on the
floor, and instead queues them up for retrying.

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 028ef9c9
Loading
Loading
Loading
Loading
+20 −10
Original line number Diff line number Diff line
@@ -9769,16 +9769,26 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
	if (!nfs41_sequence_process(task, &lrp->res.seq_res))
		return;

	if (task->tk_rpc_status == -ETIMEDOUT) {
	if (task->tk_rpc_status < 0) {
		switch (task->tk_rpc_status) {
		case -EACCES:
		case -EIO:
		case -EKEYEXPIRED:
		case -ERESTARTSYS:
		case -EINTR:
			lrp->rpc_status = 0;
			break;
		case -ENETDOWN:
		case -ENETUNREACH:
			if (task->tk_flags & RPC_TASK_NETUNREACH_FATAL)
				lrp->rpc_status = 0;
			else
				lrp->rpc_status = -EAGAIN;
		lrp->res.lrs_present = 0;
		return;
			break;
		default:
			lrp->rpc_status = -EAGAIN;
			break;
		}
	/*
	 * Was there an RPC level error? Assume the call succeeded,
	 * and that we need to release the layout
	 */
	if (task->tk_rpc_status != 0 && RPC_WAS_SENT(task)) {
		lrp->res.lrs_present = 0;
		return;
	}
+17 −5
Original line number Diff line number Diff line
@@ -1698,11 +1698,23 @@ int pnfs_roc_done(struct rpc_task *task, struct nfs4_layoutreturn_args **argpp,
		/* If the call was not sent, let caller handle it */
		if (!RPC_WAS_SENT(task))
			return 0;
		switch (task->tk_rpc_status) {
		default:
			/*
		 * Otherwise, assume the call succeeded and
		 * that we need to release the layout
			 * Defer the layoutreturn if it was due
			 * to the server being down.
			 */
			*ret = -NFS4ERR_NOMATCHING_LAYOUT;
			break;
		case -EACCES:
		case -EIO:
		case -EKEYEXPIRED:
		case -ERESTARTSYS:
		case -EINTR:
			/* Don't retry */
			*ret = 0;
			break;
		}
		(*respp)->lrs_present = 0;
		retval = 0;
		break;