aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorKinglong Mee <kinglongmee@gmail.com>2016-01-03 22:15:21 -0500
committerJ. Bruce Fields <bfields@redhat.com>2016-01-07 10:10:51 -0500
commit691412b4438da1b77ff3078de0546023d244d841 (patch)
treeb23ae6846ff28efbff35081bbe6f1c36daf641cb /fs/nfsd
parent2a297450dd188a5d4e5e428c189b2de54f9073ba (diff)
nfsd: Fix nfsd leaks sunrpc module references
Stefan Hajnoczi reports, nfsd leaks 3 references to the sunrpc module here: # echo -n "asdf 1234" >/proc/fs/nfsd/portlist bash: echo: write error: Protocol not supported Now stop nfsd and try unloading the kernel modules: # systemctl stop nfs-server # systemctl stop nfs # systemctl stop proc-fs-nfsd.mount # systemctl stop var-lib-nfs-rpc_pipefs.mount # rmmod nfsd # rmmod nfs_acl # rmmod lockd # rmmod auth_rpcgss # rmmod sunrpc rmmod: ERROR: Module sunrpc is in use # lsmod | grep rpc sunrpc 315392 3 It is caused by nfsd don't cleanup rpcb program for nfsd when destroying svc service after creating xprt fail. Reported-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfssvc.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 3779a5fbeb42..45007acaf364 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -378,14 +378,13 @@ static void nfsd_last_thread(struct svc_serv *serv, struct net *net)
378 * write_ports can create the server without actually starting 378 * write_ports can create the server without actually starting
379 * any threads--if we get shut down before any threads are 379 * any threads--if we get shut down before any threads are
380 * started, then nfsd_last_thread will be run before any of this 380 * started, then nfsd_last_thread will be run before any of this
381 * other initialization has been done. 381 * other initialization has been done except the rpcb information.
382 */ 382 */
383 svc_rpcb_cleanup(serv, net);
383 if (!nn->nfsd_net_up) 384 if (!nn->nfsd_net_up)
384 return; 385 return;
385 nfsd_shutdown_net(net);
386
387 svc_rpcb_cleanup(serv, net);
388 386
387 nfsd_shutdown_net(net);
389 printk(KERN_WARNING "nfsd: last server has exited, flushing export " 388 printk(KERN_WARNING "nfsd: last server has exited, flushing export "
390 "cache\n"); 389 "cache\n");
391 nfsd_export_flush(net); 390 nfsd_export_flush(net);