And svc_tcp_accept was called by svc_recv() [net/sunrpc/svc_xprt.c]
if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) {
<snip>
newxpt = xprt->xpt_ops->xpo_accept(xprt);
<snip>
So this might happen when xprt->xpt_flags has both XPT_LISTENER and XPT_CLOSE.
Let's take a look at commit b0401d72, this commit has moved the close
processing after do recvfrom method, but this commit also introduces this
warnings, if the xpt_flags has both XPT_LISTENER and XPT_CLOSED, we should
close it, not accpet then close.
Signed-off-by: Xiaotian Feng <df...@redhat.com>
Cc: J. Bruce Fields <bfi...@fieldses.org>
Cc: Neil Brown <ne...@suse.de>
Cc: Trond Myklebust <Trond.M...@netapp.com>
Cc: David S. Miller <da...@davemloft.net>
---
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 1c924ee..187f0f4 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -699,7 +699,8 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
spin_unlock_bh(&pool->sp_lock);
len = 0;
- if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) {
+ if (test_bit(XPT_LISTENER, &xprt->xpt_flags) &&
+ !test_bit(XPT_CLOSE, &xprt->xpt_flags)) {
struct svc_xprt *newxpt;
newxpt = xprt->xpt_ops->xpo_accept(xprt);
if (newxpt) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
--
-------------------------------------
Ing. Nikola CIPRICH
LinuxBox.cz, s.r.o.
28. rijna 168, 709 01 Ostrava
tel.: +420 596 603 142
fax: +420 596 621 273
mobil: +420 777 093 799
www.linuxbox.cz
mobil servis: +420 737 238 656
email servis: ser...@linuxbox.cz
-------------------------------------
The logic here seems unnecessarily complicated now, but as a minimal
fix, this seems fine.
Is the *only* justification for this to silence this warning, or is
there some more serious problem I'm missing?
--b.
If a xprt->xpt_flags has XPT_CLOSE & XPT_LISTENER, kernel will accept it
first,
and svc_xprt_received(xptr) no mater xpo_accept is suceed or failed,
then svc_delete_xprt(xprt).
I'm not sure what will happened between the svc_xprt_received and
svc_delete_xprt, there isn't any
lock to protect it.
>
> --b.
>
>>
>> Signed-off-by: Xiaotian Feng<df...@redhat.com>
>> Cc: J. Bruce Fields<bfi...@fieldses.org>
>> Cc: Neil Brown<ne...@suse.de>
>> Cc: Trond Myklebust<Trond.M...@netapp.com>
>> Cc: David S. Miller<da...@davemloft.net>
>> ---
>> diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
>> index 1c924ee..187f0f4 100644
>> --- a/net/sunrpc/svc_xprt.c
>> +++ b/net/sunrpc/svc_xprt.c
>> @@ -699,7 +699,8 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
>> spin_unlock_bh(&pool->sp_lock);
>>
>> len = 0;
>> - if (test_bit(XPT_LISTENER,&xprt->xpt_flags)) {
>> + if (test_bit(XPT_LISTENER,&xprt->xpt_flags)&&
>> + !test_bit(XPT_CLOSE,&xprt->xpt_flags)) {