diff options
Diffstat (limited to 'net/sunrpc/svc_xprt.c')
-rw-r--r-- | net/sunrpc/svc_xprt.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 6ebc9a95bbab..194d865fae72 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
@@ -679,6 +679,23 @@ struct svc_xprt *svc_get_next_xprt(struct svc_rqst *rqstp, long timeout) | |||
679 | return xprt; | 679 | return xprt; |
680 | } | 680 | } |
681 | 681 | ||
682 | void svc_add_new_temp_xprt(struct svc_serv *serv, struct svc_xprt *newxpt) | ||
683 | { | ||
684 | spin_lock_bh(&serv->sv_lock); | ||
685 | set_bit(XPT_TEMP, &newxpt->xpt_flags); | ||
686 | list_add(&newxpt->xpt_list, &serv->sv_tempsocks); | ||
687 | serv->sv_tmpcnt++; | ||
688 | if (serv->sv_temptimer.function == NULL) { | ||
689 | /* setup timer to age temp transports */ | ||
690 | setup_timer(&serv->sv_temptimer, svc_age_temp_xprts, | ||
691 | (unsigned long)serv); | ||
692 | mod_timer(&serv->sv_temptimer, | ||
693 | jiffies + svc_conn_age_period * HZ); | ||
694 | } | ||
695 | spin_unlock_bh(&serv->sv_lock); | ||
696 | svc_xprt_received(newxpt); | ||
697 | } | ||
698 | |||
682 | static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt) | 699 | static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt) |
683 | { | 700 | { |
684 | struct svc_serv *serv = rqstp->rq_server; | 701 | struct svc_serv *serv = rqstp->rq_server; |
@@ -692,29 +709,15 @@ static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt) | |||
692 | } | 709 | } |
693 | if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) { | 710 | if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) { |
694 | struct svc_xprt *newxpt; | 711 | struct svc_xprt *newxpt; |
712 | /* | ||
713 | * We know this module_get will succeed because the | ||
714 | * listener holds a reference too | ||
715 | */ | ||
716 | __module_get(xprt->xpt_class->xcl_owner); | ||
717 | svc_check_conn_limits(xprt->xpt_server); | ||
695 | newxpt = xprt->xpt_ops->xpo_accept(xprt); | 718 | newxpt = xprt->xpt_ops->xpo_accept(xprt); |
696 | if (newxpt) { | 719 | if (newxpt) |
697 | /* | 720 | svc_add_new_temp_xprt(serv, newxpt); |
698 | * We know this module_get will succeed because the | ||
699 | * listener holds a reference too | ||
700 | */ | ||
701 | __module_get(newxpt->xpt_class->xcl_owner); | ||
702 | svc_check_conn_limits(xprt->xpt_server); | ||
703 | spin_lock_bh(&serv->sv_lock); | ||
704 | set_bit(XPT_TEMP, &newxpt->xpt_flags); | ||
705 | list_add(&newxpt->xpt_list, &serv->sv_tempsocks); | ||
706 | serv->sv_tmpcnt++; | ||
707 | if (serv->sv_temptimer.function == NULL) { | ||
708 | /* setup timer to age temp transports */ | ||
709 | setup_timer(&serv->sv_temptimer, | ||
710 | svc_age_temp_xprts, | ||
711 | (unsigned long)serv); | ||
712 | mod_timer(&serv->sv_temptimer, | ||
713 | jiffies + svc_conn_age_period * HZ); | ||
714 | } | ||
715 | spin_unlock_bh(&serv->sv_lock); | ||
716 | svc_xprt_received(newxpt); | ||
717 | } | ||
718 | } else if (xprt->xpt_ops->xpo_has_wspace(xprt)) { | 721 | } else if (xprt->xpt_ops->xpo_has_wspace(xprt)) { |
719 | /* XPT_DATA|XPT_DEFERRED case: */ | 722 | /* XPT_DATA|XPT_DEFERRED case: */ |
720 | dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n", | 723 | dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n", |