Subject: linux-next: manual merge of the nfsd tree with the nfs tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 21 Mar 2025 09:11:51 +1100

Hi all,

Today's linux-next merge of the nfsd tree got a conflict in:

  fs/nfsd/nfs4callback.c

between commit:

  11a149e09d58 ("sunrpc: make rpc_restart_call() and rpc_restart_call_prepare() void return")

from the nfs tree and commits:

  6c1cefb84b3d ("nfsd: lift NFSv4.0 handling out of nfsd4_cb_sequence_done()")
  f049911b5b98 ("nfsd: only check RPC_SIGNALLED() when restarting rpc_task")

from the nfsd tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/nfsd/nfs4callback.c
index 654bee80acef,ec6539cec0fe..000000000000
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@@ -1381,41 -1384,42 +1384,43 @@@ static bool nfsd4_cb_sequence_done(stru
  		fallthrough;
  	case -NFS4ERR_BADSESSION:
  		nfsd4_mark_cb_fault(cb->cb_clp);
- 		ret = false;
- 		goto need_restart;
+ 		goto requeue;
  	case -NFS4ERR_DELAY:
  		cb->cb_seq_status = 1;
 -		if (RPC_SIGNALLED(task) || !rpc_restart_call(task))
 +		rpc_restart_call(task);
++		if (RPC_SIGNALLED(task))
+ 			goto requeue;
  		rpc_delay(task, 2 * HZ);
  		return false;
- 	case -NFS4ERR_BADSLOT:
- 		goto retry_nowait;
  	case -NFS4ERR_SEQ_MISORDERED:
- 		if (session->se_cb_seq_nr[cb->cb_held_slot] != 1) {
- 			session->se_cb_seq_nr[cb->cb_held_slot] = 1;
- 			goto retry_nowait;
- 		}
- 		break;
+ 	case -NFS4ERR_BADSLOT:
+ 		/*
+ 		 * A SEQ_MISORDERED or BADSLOT error means that the client and
+ 		 * server are out of sync as to the backchannel parameters. Mark
+ 		 * the backchannel faulty and restart the RPC, but leak the slot
+ 		 * so that it's no longer used.
+ 		 */
+ 		nfsd4_mark_cb_fault(cb->cb_clp);
+ 		cb->cb_held_slot = -1;
+ 		goto retry_nowait;
  	default:
  		nfsd4_mark_cb_fault(cb->cb_clp);
  	}
  	trace_nfsd_cb_free_slot(task, cb);
  	nfsd41_cb_release_slot(cb);
- 
- 	if (RPC_SIGNALLED(task))
- 		goto need_restart;
- out:
  	return ret;
  retry_nowait:
- 	rpc_restart_call_prepare(task);
- 	ret = false;
- 	goto out;
- need_restart:
- 	if (!test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags)) {
- 		trace_nfsd_cb_restart(clp, cb);
- 		task->tk_status = 0;
- 		cb->cb_need_restart = true;
+ 	/*
+ 	 * RPC_SIGNALLED() means that the rpc_client is being torn down and
+ 	 * (possibly) recreated. Requeue the call in that case.
+ 	 */
+ 	if (!RPC_SIGNALLED(task)) {
 -		if (rpc_restart_call_prepare(task))
 -			return false;
++		rpc_restart_call_prepare(task);
++		return false;
  	}
+ requeue:
+ 	nfsd41_cb_release_slot(cb);
+ 	nfsd4_requeue_cb(task, cb);
  	return false;
  }