netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sunrpc: fix peername failed on closed listener
@ 2009-12-31  2:52 Xiaotian Feng
       [not found] ` <1262227956-21470-1-git-send-email-dfeng-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2010-01-05 23:01 ` J. Bruce Fields
  0 siblings, 2 replies; 4+ messages in thread
From: Xiaotian Feng @ 2009-12-31  2:52 UTC (permalink / raw)
  To: linux-nfs-u79uwXL29TY76Z2rM5mHXA
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Xiaotian Feng,
	J. Bruce Fields, Neil Brown, Trond Myklebust, David S. Miller

There're some warnings of "nfsd: peername failed (err 107)!"
socket error -107 means Transport endpoint is not connected.
This warning message was outputed by svc_tcp_accept() [net/sunrpc/svcsock.c],
when kernel_getpeername returns -107. This means socket might be CLOSED.

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 <dfeng-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: J. Bruce Fields <bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
Cc: Neil Brown <neilb-l3A5Bk7waGM@public.gmane.org>
Cc: Trond Myklebust <Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>
Cc: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
---
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-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] sunrpc: fix peername failed on closed listener
       [not found] ` <1262227956-21470-1-git-send-email-dfeng-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2010-01-04  7:12   ` Nikola Ciprich
  0 siblings, 0 replies; 4+ messages in thread
From: Nikola Ciprich @ 2010-01-04  7:12 UTC (permalink / raw)
  To: Xiaotian Feng
  Cc: linux-nfs-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, J. Bruce Fields, Neil Brown,
	Trond Myklebust, David S. Miller,
	nikola.ciprich-Jp3n8lUXroTtwjQa/ONI9g,
	stable-DgEjT+Ai2ygdnm+yROfE0A

(CCing stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org)
Greg, once this patch is ACKed, can You also queue it for 
2.6.32.x please?
thanks!
nik

On Thu, Dec 31, 2009 at 10:52:36AM +0800, Xiaotian Feng wrote:
> There're some warnings of "nfsd: peername failed (err 107)!"
> socket error -107 means Transport endpoint is not connected.
> This warning message was outputed by svc_tcp_accept() [net/sunrpc/svcsock.c],
> when kernel_getpeername returns -107. This means socket might be CLOSED.
> 
> 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 <dfeng-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Cc: J. Bruce Fields <bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
> Cc: Neil Brown <neilb-l3A5Bk7waGM@public.gmane.org>
> Cc: Trond Myklebust <Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>
> Cc: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
> ---
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.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: servis-Jp3n8lUXroTtwjQa/ONI9g@public.gmane.org
-------------------------------------
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sunrpc: fix peername failed on closed listener
  2009-12-31  2:52 [PATCH] sunrpc: fix peername failed on closed listener Xiaotian Feng
       [not found] ` <1262227956-21470-1-git-send-email-dfeng-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2010-01-05 23:01 ` J. Bruce Fields
       [not found]   ` <20100105230131.GA22850-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: J. Bruce Fields @ 2010-01-05 23:01 UTC (permalink / raw)
  To: Xiaotian Feng
  Cc: linux-nfs, netdev, linux-kernel, Neil Brown, Trond Myklebust,
	David S. Miller

On Thu, Dec 31, 2009 at 10:52:36AM +0800, Xiaotian Feng wrote:
> There're some warnings of "nfsd: peername failed (err 107)!"
> socket error -107 means Transport endpoint is not connected.
> This warning message was outputed by svc_tcp_accept() [net/sunrpc/svcsock.c],
> when kernel_getpeername returns -107. This means socket might be CLOSED.
> 
> 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.

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.

> 
> Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
> Cc: J. Bruce Fields <bfields@fieldses.org>
> Cc: Neil Brown <neilb@suse.de>
> Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
> Cc: David S. Miller <davem@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) {

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sunrpc: fix peername failed on closed listener
       [not found]   ` <20100105230131.GA22850-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
@ 2010-01-06  9:07     ` Xiaotian Feng
  0 siblings, 0 replies; 4+ messages in thread
From: Xiaotian Feng @ 2010-01-06  9:07 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: linux-nfs-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Neil Brown, Trond Myklebust,
	David S. Miller

On 01/06/2010 07:01 AM, J. Bruce Fields wrote:
> On Thu, Dec 31, 2009 at 10:52:36AM +0800, Xiaotian Feng wrote:
>> There're some warnings of "nfsd: peername failed (err 107)!"
>> socket error -107 means Transport endpoint is not connected.
>> This warning message was outputed by svc_tcp_accept() [net/sunrpc/svcsock.c],
>> when kernel_getpeername returns -107. This means socket might be CLOSED.
>>
>> 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.
>
> 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?

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<dfeng-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> Cc: J. Bruce Fields<bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
>> Cc: Neil Brown<neilb-l3A5Bk7waGM@public.gmane.org>
>> Cc: Trond Myklebust<Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>
>> Cc: David S. Miller<davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
>> ---
>> 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-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-01-06  9:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-31  2:52 [PATCH] sunrpc: fix peername failed on closed listener Xiaotian Feng
     [not found] ` <1262227956-21470-1-git-send-email-dfeng-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-01-04  7:12   ` Nikola Ciprich
2010-01-05 23:01 ` J. Bruce Fields
     [not found]   ` <20100105230131.GA22850-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2010-01-06  9:07     ` Xiaotian Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).