aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2013-02-10 11:33:48 -0500
committerJ. Bruce Fields <bfields@redhat.com>2013-02-17 10:53:16 -0500
commite75bafbff2270993926abcc31358361db74a9bc2 (patch)
tree2a59f30307bfa469aab049f9b804107f679460b6 /net
parentf25cc71e634edcf8a15bc60a48f2b5f3ec9fbb1d (diff)
svcrpc: make svc_age_temp_xprts enqueue under sv_lock
svc_age_temp_xprts expires xprts in a two-step process: first it takes the sv_lock and moves the xprts to expire off their server-wide list (sv_tempsocks or sv_permsocks) to a local list. Then it drops the sv_lock and enqueues and puts each one. I see no reason for this: svc_xprt_enqueue() will take sp_lock, but the sv_lock and sp_lock are not otherwise nested anywhere (and documentation at the top of this file claims it's correct to nest these with sp_lock inside.) Cc: stable@kernel.org Tested-by: Jason Tibbitts <tibbs@math.uh.edu> Tested-by: Paweł Sikora <pawel.sikora@agmk.net> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/svc_xprt.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 5a9d40c5a9f3..11a33c874848 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -863,7 +863,6 @@ static void svc_age_temp_xprts(unsigned long closure)
863 struct svc_serv *serv = (struct svc_serv *)closure; 863 struct svc_serv *serv = (struct svc_serv *)closure;
864 struct svc_xprt *xprt; 864 struct svc_xprt *xprt;
865 struct list_head *le, *next; 865 struct list_head *le, *next;
866 LIST_HEAD(to_be_aged);
867 866
868 dprintk("svc_age_temp_xprts\n"); 867 dprintk("svc_age_temp_xprts\n");
869 868
@@ -884,25 +883,15 @@ static void svc_age_temp_xprts(unsigned long closure)
884 if (atomic_read(&xprt->xpt_ref.refcount) > 1 || 883 if (atomic_read(&xprt->xpt_ref.refcount) > 1 ||
885 test_bit(XPT_BUSY, &xprt->xpt_flags)) 884 test_bit(XPT_BUSY, &xprt->xpt_flags))
886 continue; 885 continue;
887 svc_xprt_get(xprt); 886 list_del_init(le);
888 list_move(le, &to_be_aged);
889 set_bit(XPT_CLOSE, &xprt->xpt_flags); 887 set_bit(XPT_CLOSE, &xprt->xpt_flags);
890 set_bit(XPT_DETACHED, &xprt->xpt_flags); 888 set_bit(XPT_DETACHED, &xprt->xpt_flags);
891 }
892 spin_unlock_bh(&serv->sv_lock);
893
894 while (!list_empty(&to_be_aged)) {
895 le = to_be_aged.next;
896 /* fiddling the xpt_list node is safe 'cos we're XPT_DETACHED */
897 list_del_init(le);
898 xprt = list_entry(le, struct svc_xprt, xpt_list);
899
900 dprintk("queuing xprt %p for closing\n", xprt); 889 dprintk("queuing xprt %p for closing\n", xprt);
901 890
902 /* a thread will dequeue and close it soon */ 891 /* a thread will dequeue and close it soon */
903 svc_xprt_enqueue(xprt); 892 svc_xprt_enqueue(xprt);
904 svc_xprt_put(xprt);
905 } 893 }
894 spin_unlock_bh(&serv->sv_lock);
906 895
907 mod_timer(&serv->sv_temptimer, jiffies + svc_conn_age_period * HZ); 896 mod_timer(&serv->sv_temptimer, jiffies + svc_conn_age_period * HZ);
908} 897}