Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

SUNRPC: Move the svc_rpcb_cleanup() call sites

Clean up: because svc_rpcb_cleanup() and svc_xprt_destroy_all()
are always invoked in pairs, we can deduplicate code by moving
the svc_rpcb_cleanup() call sites into svc_xprt_destroy_all().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Tested-by: Olga Kornievskaia <okorniev@redhat.com>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>

authored by

Chuck Lever and committed by
Anna Schumaker
62c0c0e7 c231cea1

+14 -14
+2 -4
fs/lockd/svc.c
··· 216 216 if (warned++ == 0) 217 217 printk(KERN_WARNING 218 218 "lockd_up: makesock failed, error=%d\n", err); 219 - svc_xprt_destroy_all(serv, net); 220 - svc_rpcb_cleanup(serv, net); 219 + svc_xprt_destroy_all(serv, net, true); 221 220 return err; 222 221 } 223 222 ··· 254 255 nlm_shutdown_hosts_net(net); 255 256 cancel_delayed_work_sync(&ln->grace_period_end); 256 257 locks_end_grace(&ln->lockd_manager); 257 - svc_xprt_destroy_all(serv, net); 258 - svc_rpcb_cleanup(serv, net); 258 + svc_xprt_destroy_all(serv, net, true); 259 259 } 260 260 } else { 261 261 pr_err("%s: no users! net=%x\n",
+1 -1
fs/nfs/callback.c
··· 136 136 return; 137 137 138 138 dprintk("NFS: destroy per-net callback data; net=%x\n", net->ns.inum); 139 - svc_xprt_destroy_all(serv, net); 139 + svc_xprt_destroy_all(serv, net, false); 140 140 } 141 141 142 142 static int nfs_callback_up_net(int minorversion, struct svc_serv *serv,
+1 -1
fs/nfsd/nfsctl.c
··· 1993 1993 * remaining listeners and recreate the list. 1994 1994 */ 1995 1995 if (delete) 1996 - svc_xprt_destroy_all(serv, net); 1996 + svc_xprt_destroy_all(serv, net, false); 1997 1997 1998 1998 /* walk list of addrs again, open any that still don't exist */ 1999 1999 nlmsg_for_each_attr_type(attr, NFSD_A_SERVER_SOCK_ADDR, info->nlhdr,
+2 -5
fs/nfsd/nfssvc.c
··· 535 535 #endif 536 536 } 537 537 538 - svc_xprt_destroy_all(serv, net); 539 - 540 538 /* 541 539 * write_ports can create the server without actually starting 542 - * any threads--if we get shut down before any threads are 540 + * any threads. If we get shut down before any threads are 543 541 * started, then nfsd_destroy_serv will be run before any of this 544 542 * other initialization has been done except the rpcb information. 545 543 */ 546 - svc_rpcb_cleanup(serv, net); 547 - 544 + svc_xprt_destroy_all(serv, net, true); 548 545 nfsd_shutdown_net(net); 549 546 svc_destroy(&serv); 550 547 }
+2 -1
include/linux/sunrpc/svc_xprt.h
··· 165 165 struct net *net, const int family, 166 166 const unsigned short port, int flags, 167 167 const struct cred *cred); 168 - void svc_xprt_destroy_all(struct svc_serv *serv, struct net *net); 168 + void svc_xprt_destroy_all(struct svc_serv *serv, struct net *net, 169 + bool unregister); 169 170 void svc_xprt_received(struct svc_xprt *xprt); 170 171 void svc_xprt_enqueue(struct svc_xprt *xprt); 171 172 void svc_xprt_put(struct svc_xprt *xprt);
-1
net/sunrpc/svc.c
··· 436 436 svc_unregister(serv, net); 437 437 rpcb_put_local(net); 438 438 } 439 - EXPORT_SYMBOL_GPL(svc_rpcb_cleanup); 440 439 441 440 static int svc_uses_rpcbind(struct svc_serv *serv) 442 441 {
+6 -1
net/sunrpc/svc_xprt.c
··· 1102 1102 * svc_xprt_destroy_all - Destroy transports associated with @serv 1103 1103 * @serv: RPC service to be shut down 1104 1104 * @net: target network namespace 1105 + * @unregister: true if it is OK to unregister the destroyed xprts 1105 1106 * 1106 1107 * Server threads may still be running (especially in the case where the 1107 1108 * service is still running in other network namespaces). ··· 1115 1114 * threads, we may need to wait a little while and then check again to 1116 1115 * see if they're done. 1117 1116 */ 1118 - void svc_xprt_destroy_all(struct svc_serv *serv, struct net *net) 1117 + void svc_xprt_destroy_all(struct svc_serv *serv, struct net *net, 1118 + bool unregister) 1119 1119 { 1120 1120 int delay = 0; 1121 1121 ··· 1126 1124 svc_clean_up_xprts(serv, net); 1127 1125 msleep(delay++); 1128 1126 } 1127 + 1128 + if (unregister) 1129 + svc_rpcb_cleanup(serv, net); 1129 1130 } 1130 1131 EXPORT_SYMBOL_GPL(svc_xprt_destroy_all); 1131 1132