Patch "sunrpc: don't call sleeping functions from the notifier block callbacks" has been added to the 4.9-stable tree
Subsystems (4)
This is a note to let you know that I've just added the patch titled
sunrpc: don't call sleeping functions from the notifier block callbacks
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
sunrpc-don-t-call-sleeping-functions-from-the-notifier-block-callbacks.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
546125d1614264d26080817d0c8cddb9b25081faMon Sep 17 00:00:00 2001
From: Scott Mayhew <[email protected]>
Date: Thu, 5 Jan 2017 16:34:51 -0500
Subject: sunrpc: don't call sleeping functions from the notifier block callbacks
From: Scott Mayhew <[email protected]>
commit 546125d1614264d26080817d0c8cddb9b25081fa upstream.
The inet6addr_chain is an atomic notifier chain, so we can't call anything that might sleep (like lock_sock)... instead of closing the socket from svc_age_temp_xprts_now (which is called by the notifier function), just have the rpc service threads do it instead.
--- include/linux/sunrpc/svc_xprt.h | 1 + net/sunrpc/svc_xprt.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-)
include/linux/sunrpc/svc_xprt.h +1 -0
@@ -66,6 +66,7 @@ struct svc_xprt {#define XPT_LISTENER 10/* listening endpoint */ #define XPT_CACHE_AUTH 11/* cache auth info */ #define XPT_LOCAL 12/* connection from loopback interface */ +#define XPT_KILL_TEMP 13/* call xpo_kill_temp_xprt before closing */ struct svc_serv *xpt_server;/* service for transport */ atomic_t xpt_reserved;/* space on outq that is rsvd */
net/sunrpc/svc_xprt.c +7 -3
@@ -799,6 +799,8 @@ static int svc_handle_xprt(struct svc_rqif (test_bit (XPT_CLOSE , &xprt->xpt_flags)) {dprintk ("svc_recv: found XPT_CLOSE\n" ); +if (test_and_clear_bit (XPT_KILL_TEMP , &xprt->xpt_flags)) + xprt->xpt_ops->xpo_kill_temp_xprt (xprt);svc_delete_xprt (xprt);/* Leave XPT_BUSY set on the dead xprt: */ goto out;
@@ -1020,9 +1022,11 @@ void svc_age_temp_xprts_now(struct svc_s le = to_be_closed.next;list_del_init (le); xprt = list_entry(le, struct svc_xprt, xpt_list); -dprintk ("svc_age_temp_xprts_now: closing %p\n" , xprt); - xprt->xpt_ops->xpo_kill_temp_xprt (xprt); -svc_close_xprt (xprt); +set_bit (XPT_CLOSE , &xprt->xpt_flags); +set_bit (XPT_KILL_TEMP , &xprt->xpt_flags); +dprintk ("svc_age_temp_xprts_now: queuing xprt %p for closing\n" , + xprt); +svc_xprt_enqueue (xprt); } }EXPORT_SYMBOL_GPL (svc_age_temp_xprts_now);
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/sunrpc-don-t-call-sleeping-functions-from-the-notifier-block-callbacks.patch