NFSD: Fix BUG during NFSD shutdown processing
Subsystems (2)
PATCH 1/1 NFSD: Fix BUG during NFSD shutdown processing
The Linux NFS server can be started via a user-space write to /proc/fs/nfs/threads or to /proc/fs/nfs/portlist. In the first case, all default listeners are started (both UDP and TCP). In the second, a listener is started only for one specified transport.
The NFS server has to make sure lockd stays up until the last listener transport goes away. To support both start-up interfaces, it should do one lockd_up() for each NFSD listener.
The nfsd_init_socks() function used to do one lockd_up() call for each svc_create_xprt(). Recently commit 26a414092353590ceaa5955bcb53f863d6ea7549 mistakenly changed nfsd_init_socks() to do only one lockd_up() call even though it still does two svc_create_xprt() calls.
The end result is a lockd_down() BUG during NFSD shutdown processing because nfsd_last_threads() does a lockd_down() call for each entry on the sv_permsocks list, but the start-up code doesn't do a matching number of lockd_up() calls.
Add a second lockd_up() in nfsd_init_socks() to make sure the number of lockd_up() calls matches the number of entries on the NFS servers's sv_permsocks list.
---
fs/nfsd/nfssvc.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
fs/nfsd/nfssvc.c +4 -0
@@ -249,6 +249,10 @@ static int nfsd_init_socks(int port)if (error <0 )return error; + error =lockd_up (); +if (error <0 ) +return error; + error =svc_create_xprt (nfsd_serv,"tcp" , port,SVC_SOCK_DEFAULTS );if (error <0 )
A message that is not in the archive (sent off-list or not yet received): 20081022171235.5152.7645.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org
Quoted 20 lines · Chuck Lever
The Linux NFS server can be started via a user-space write to
/proc/fs/nfs/threadsor to/proc/fs/nfs/portlist. In the first case, all default listeners are started (both UDP and TCP). In the second, a listener is started only for one specified transport.The NFS server has to make sure lockd stays up until the last listener transport goes away. To support both start-up interfaces, it should do one
lockd_up()for each NFSD listener.The
nfsd_init_socks()function used to do onelockd_up()call for eachsvc_create_xprt(). Recently commit26a414092353590ceaa5955bcb53f863d6ea7549mistakenly changednfsd_init_socks()to do only onelockd_up()call even though it still does twosvc_create_xprt()calls.The end result is a
lockd_down()BUG during NFSD shutdown processing becausenfsd_last_threads()does alockd_down()call for each entry on thesv_permsockslist, but the start-up code doesn't do a matching number oflockd_up()calls.
Quoted 5 lines
Add a second
lockd_up()innfsd_init_socks()to make sure the number oflockd_up()calls matches the number of entries on the NFS servers'ssv_permsockslist.Signed-off-by Chuck Lever <[email protected]>
Thanks; applied to for-2.6.28; I'll pass it along to Linus soon.
--b.
Quoted 21 lines
---
fs/nfsd/nfssvc.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)fs/nfsd/nfssvc.c +4
-0@@ -249,6 +249,10 @@ static int nfsd_init_socks(int port)if (error <0 )return error; + error =lockd_up (); +if (error <0 ) +return error; + error =svc_create_xprt (nfsd_serv,"tcp" , port,SVC_SOCK_DEFAULTS );if (error <0 )