Revert "svcrpc: destroy server sockets all at once" from 2.6.32.y
Subsystems (3)
PATCH 1/1 Revert "svcrpc: destroy server sockets all at once" from 2.6.32.y
This reverts commit 4ad71a69292de1f9d8f7a38a3f7e6508e89b3089 from 2.6.32.y
That commit (2fefb8a09e7ed251ae8996e0c69066e74c5aa560 in mainline) was not a bugfix. It was sent to -stable because it is a necessary precursor for
commit b4f36f88b3ee7cf26bf0be84e6c7fc15f84dcb71
svcrpc: avoid memory-corruption on pool shutdown
However that patch didn't make it to 2.6.32.y, presumably because it doesn't apply. So this commit (2fefb8a09e7e) shouldn't have been applied either.
It is a problem because in 2.6.32, it is important to delay destroying the permsocks until after ->sv_shutdown has been called. The nfsd sv_shutdown walks the list of permsocks and calls lockd_down() for each. If the permsocks have already been closed, lockd_down() isn't called so the lockd thread never exits.
(upstream commit
commit ac77efbe2b4d2a1e571a4f1e5b6e47de72a7d737
nfsd: just keep single lockd reference for nfsd
changes nfsd so that the patch being reverted here is safe. It went into 2.6.36).
include/linux/sunrpc/svcsock.h +1 -1
@@ -34,7 +34,7 @@ struct svc_sock {/* * Function prototypes. */ -void svc_close_all (struct svc_serv *); +void svc_close_all (struct list_head *);int svc_recv (struct svc_rqst *,long );int svc_send (struct svc_rqst *);void svc_drop (struct svc_rqst *);
net/sunrpc/svc.c +6 -1
@@ -475,11 +475,16 @@ svc_destroy(struct svc_serv *serv)del_timer_sync (&serv->sv_temptimer); -svc_close_all (serv); +svc_close_all (&serv->sv_tempsocks);if (serv->sv_shutdown) serv->sv_shutdown (serv); +svc_close_all (&serv->sv_permsocks); + +BUG_ON (!list_empty (&serv->sv_permsocks)); +BUG_ON (!list_empty (&serv->sv_tempsocks)); +cache_clean_deferred (serv);if (svc_serv_is_pooled (serv))
net/sunrpc/svc_xprt.c +1 -10
@@ -927,7 +927,7 @@ void svc_close_xprt(struct svc_xprt *xprt) }EXPORT_SYMBOL_GPL (svc_close_xprt); -static void svc_close_list (struct list_head *xprt_list) +void svc_close_all (struct list_head *xprt_list) {struct svc_xprt *xprt;struct svc_xprt *tmp;
@@ -945,15 +945,6 @@ static void svc_close_list(struct list_head *xprt_list) } } -void svc_close_all (struct svc_serv *serv) -{ -svc_close_list (&serv->sv_tempsocks); -svc_close_list (&serv->sv_permsocks); -BUG_ON (!list_empty (&serv->sv_permsocks)); -BUG_ON (!list_empty (&serv->sv_tempsocks)); - -} -/* * Handle defer and revisit of requests */
Quoted 19 lines · NeilBrown
This reverts commit
4ad71a69292de1f9d8f7a38a3f7e6508e89b3089from 2.6.32.yThat commit (
2fefb8a09e7ed251ae8996e0c69066e74c5aa560in mainline) was not a bugfix. It was sent to -stable because it is a necessary precursor for
commitb4f36f88b3ee7cf26bf0be84e6c7fc15f84dcb71
svcrpc: avoid memory-corruption on pool shutdownHowever that patch didn't make it to 2.6.32.y, presumably because it doesn't apply. So this commit (
2fefb8a09e7e) shouldn't have been applied either.It is a problem because in 2.6.32, it is important to delay destroying the permsocks until after ->sv_shutdown has been called. The nfsd
sv_shutdownwalks the list of permsocks and callslockd_down()for each. If the permsocks have already been closed,lockd_down()isn't called so the lockd thread never exits.
Quoted 5 lines
(upstream commit
commitac77efbe2b4d2a1e571a4f1e5b6e47de72a7d737
nfsd: just keep single lockd reference for nfsd
changes nfsd so that the patch being reverted here is safe. It went into 2.6.36).
--b.
Quoted 68 lines
Cc "J.Bruce Fields" <[email protected]>Signed-off-by NeilBrown <[email protected]>include/linux/sunrpc/svcsock.h +1
-1@@ -34,7 +34,7 @@ struct svc_sock {/* * Function prototypes. */ -void svc_close_all (struct svc_serv *); +void svc_close_all (struct list_head *);int svc_recv (struct svc_rqst *,long );int svc_send (struct svc_rqst *);void svc_drop (struct svc_rqst *);net/sunrpc/svc.c +6
-1@@ -475,11 +475,16 @@ svc_destroy(struct svc_serv *serv)del_timer_sync (&serv->sv_temptimer); -svc_close_all (serv); +svc_close_all (&serv->sv_tempsocks);if (serv->sv_shutdown) serv->sv_shutdown (serv); +svc_close_all (&serv->sv_permsocks); + +BUG_ON (!list_empty (&serv->sv_permsocks)); +BUG_ON (!list_empty (&serv->sv_tempsocks)); +cache_clean_deferred (serv);if (svc_serv_is_pooled (serv))net/sunrpc/svc_xprt.c +1
-10@@ -927,7 +927,7 @@ void svc_close_xprt(struct svc_xprt *xprt) }EXPORT_SYMBOL_GPL (svc_close_xprt); -static void svc_close_list (struct list_head *xprt_list) +void svc_close_all (struct list_head *xprt_list) {struct svc_xprt *xprt;struct svc_xprt *tmp;@@ -945,15 +945,6 @@ static void svc_close_list(struct list_head *xprt_list) } } -void svc_close_all (struct svc_serv *serv) -{ -svc_close_list (&serv->sv_tempsocks); -svc_close_list (&serv->sv_permsocks); -BUG_ON (!list_empty (&serv->sv_permsocks)); -BUG_ON (!list_empty (&serv->sv_tempsocks)); - -} -/* * Handle defer and revisit of requests */