aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/svcsock.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index fa57e9bc68e4..e43412bb07ae 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -1656,49 +1656,50 @@ svc_send(struct svc_rqst *rqstp)
1656 * Timer function to close old temporary sockets, using 1656 * Timer function to close old temporary sockets, using
1657 * a mark-and-sweep algorithm. 1657 * a mark-and-sweep algorithm.
1658 */ 1658 */
1659static void 1659static void svc_age_temp_xprts(unsigned long closure)
1660svc_age_temp_sockets(unsigned long closure)
1661{ 1660{
1662 struct svc_serv *serv = (struct svc_serv *)closure; 1661 struct svc_serv *serv = (struct svc_serv *)closure;
1663 struct svc_sock *svsk; 1662 struct svc_xprt *xprt;
1664 struct list_head *le, *next; 1663 struct list_head *le, *next;
1665 LIST_HEAD(to_be_aged); 1664 LIST_HEAD(to_be_aged);
1666 1665
1667 dprintk("svc_age_temp_sockets\n"); 1666 dprintk("svc_age_temp_xprts\n");
1668 1667
1669 if (!spin_trylock_bh(&serv->sv_lock)) { 1668 if (!spin_trylock_bh(&serv->sv_lock)) {
1670 /* busy, try again 1 sec later */ 1669 /* busy, try again 1 sec later */
1671 dprintk("svc_age_temp_sockets: busy\n"); 1670 dprintk("svc_age_temp_xprts: busy\n");
1672 mod_timer(&serv->sv_temptimer, jiffies + HZ); 1671 mod_timer(&serv->sv_temptimer, jiffies + HZ);
1673 return; 1672 return;
1674 } 1673 }
1675 1674
1676 list_for_each_safe(le, next, &serv->sv_tempsocks) { 1675 list_for_each_safe(le, next, &serv->sv_tempsocks) {
1677 svsk = list_entry(le, struct svc_sock, sk_xprt.xpt_list); 1676 xprt = list_entry(le, struct svc_xprt, xpt_list);
1678 1677
1679 if (!test_and_set_bit(XPT_OLD, &svsk->sk_xprt.xpt_flags)) 1678 /* First time through, just mark it OLD. Second time
1679 * through, close it. */
1680 if (!test_and_set_bit(XPT_OLD, &xprt->xpt_flags))
1680 continue; 1681 continue;
1681 if (atomic_read(&svsk->sk_xprt.xpt_ref.refcount) > 1 1682 if (atomic_read(&xprt->xpt_ref.refcount) > 1
1682 || test_bit(XPT_BUSY, &svsk->sk_xprt.xpt_flags)) 1683 || test_bit(XPT_BUSY, &xprt->xpt_flags))
1683 continue; 1684 continue;
1684 svc_xprt_get(&svsk->sk_xprt); 1685 svc_xprt_get(xprt);
1685 list_move(le, &to_be_aged); 1686 list_move(le, &to_be_aged);
1686 set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); 1687 set_bit(XPT_CLOSE, &xprt->xpt_flags);
1687 set_bit(XPT_DETACHED, &svsk->sk_xprt.xpt_flags); 1688 set_bit(XPT_DETACHED, &xprt->xpt_flags);
1688 } 1689 }
1689 spin_unlock_bh(&serv->sv_lock); 1690 spin_unlock_bh(&serv->sv_lock);
1690 1691
1691 while (!list_empty(&to_be_aged)) { 1692 while (!list_empty(&to_be_aged)) {
1692 le = to_be_aged.next; 1693 le = to_be_aged.next;
1693 /* fiddling the sk_xprt.xpt_list node is safe 'cos we're XPT_DETACHED */ 1694 /* fiddling the xpt_list node is safe 'cos we're XPT_DETACHED */
1694 list_del_init(le); 1695 list_del_init(le);
1695 svsk = list_entry(le, struct svc_sock, sk_xprt.xpt_list); 1696 xprt = list_entry(le, struct svc_xprt, xpt_list);
1696 1697
1697 dprintk("queuing svsk %p for closing\n", svsk); 1698 dprintk("queuing xprt %p for closing\n", xprt);
1698 1699
1699 /* a thread will dequeue and close it soon */ 1700 /* a thread will dequeue and close it soon */
1700 svc_xprt_enqueue(&svsk->sk_xprt); 1701 svc_xprt_enqueue(xprt);
1701 svc_xprt_put(&svsk->sk_xprt); 1702 svc_xprt_put(xprt);
1702 } 1703 }
1703 1704
1704 mod_timer(&serv->sv_temptimer, jiffies + svc_conn_age_period * HZ); 1705 mod_timer(&serv->sv_temptimer, jiffies + svc_conn_age_period * HZ);
@@ -1756,7 +1757,7 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
1756 serv->sv_tmpcnt++; 1757 serv->sv_tmpcnt++;
1757 if (serv->sv_temptimer.function == NULL) { 1758 if (serv->sv_temptimer.function == NULL) {
1758 /* setup timer to age temp sockets */ 1759 /* setup timer to age temp sockets */
1759 setup_timer(&serv->sv_temptimer, svc_age_temp_sockets, 1760 setup_timer(&serv->sv_temptimer, svc_age_temp_xprts,
1760 (unsigned long)serv); 1761 (unsigned long)serv);
1761 mod_timer(&serv->sv_temptimer, 1762 mod_timer(&serv->sv_temptimer,
1762 jiffies + svc_conn_age_period * HZ); 1763 jiffies + svc_conn_age_period * HZ);