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

From: Stephen Rothwell <[email-masked]>
Date: Fri, 5 Jan 2024 11:00:07 +1100

Hi all,

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

  fs/nfsd/nfsctl.c

between commit:

  76d296a82657 ("nfsd: drop the nfsd_put helper")

from the nfsd-fixes tree and commits:

  3a0b966ab40f ("SUNRPC: discard sv_refcnt, and svc_get/svc_put")
  9bf4b41b79a3 ("nfsd: rename nfsd_last_thread() to nfsd_destroy_serv()")

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/nfsctl.c
index 87fed75808ff,cca1dd7b8c55..000000000000
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@@ -704,15 -707,12 +708,12 @@@ static ssize_t __write_ports_addfd(cha
  	if (err != 0)
  		return err;
  
 -	err = svc_addsock(nn->nfsd_serv, net, fd, buf, SIMPLE_TRANSACTION_LIMIT, cred);
 +	serv = nn->nfsd_serv;
 +	err = svc_addsock(serv, net, fd, buf, SIMPLE_TRANSACTION_LIMIT, cred);
  
- 	if (err < 0 && !serv->sv_nrthreads && !nn->keep_active)
- 		nfsd_last_thread(net);
- 	else if (err >= 0 && !serv->sv_nrthreads && !xchg(&nn->keep_active, 1))
- 		svc_get(serv);
 -	if (!nn->nfsd_serv->sv_nrthreads &&
 -	    list_empty(&nn->nfsd_serv->sv_permsocks))
++	if (!serv->sv_nrthreads && list_empty(&serv->sv_permsocks))
+ 		nfsd_destroy_serv(net);
  
- 	svc_put(serv);
  	return err;
  }
  
@@@ -750,22 -748,18 +751,17 @@@ static ssize_t __write_ports_addxprt(ch
  	if (err < 0 && err != -EAFNOSUPPORT)
  		goto out_close;
  
- 	if (!serv->sv_nrthreads && !xchg(&nn->keep_active, 1))
- 		svc_get(serv);
- 
- 	svc_put(serv);
  	return 0;
  out_close:
 -	xprt = svc_find_xprt(nn->nfsd_serv, transport, net, PF_INET, port);
 +	xprt = svc_find_xprt(serv, transport, net, PF_INET, port);
  	if (xprt != NULL) {
  		svc_xprt_close(xprt);
  		svc_xprt_put(xprt);
  	}
  out_err:
- 	if (!serv->sv_nrthreads && !nn->keep_active)
- 		nfsd_last_thread(net);
 -	if (!nn->nfsd_serv->sv_nrthreads &&
 -	    list_empty(&nn->nfsd_serv->sv_permsocks))
++	if (!serv->sv_nrthreads && list_empty(&serv->sv_permsocks))
+ 		nfsd_destroy_serv(net);
  
- 	svc_put(serv);
  	return err;
  }