diff mbox series

sunrpc: handle -ENOTCONN in xs_tcp_setup_socket()

Message ID 172845168634.444407.8582369591049332159@noble.neil.brown.name (mailing list archive)
State New
Headers show
Series sunrpc: handle -ENOTCONN in xs_tcp_setup_socket() | expand

Commit Message

NeilBrown Oct. 9, 2024, 5:28 a.m. UTC
xs_tcp_finish_connecting() can return -ENOTCONN but the switch statement
in xs_tcp_setup_socket() treats that as an unhandled error.

If we treat it as a known error it would propagate back to
call_connect_status() which does handle that error code.  This appears
to be the intention of the commit (given below) which added -ENOTCONN as
a return status for xs_tcp_finish_connecting().

So add -ENOTCONN to the switch statement as an error to pass through to
the caller.

Link: https://bugzilla.suse.com/show_bug.cgi?id=1231050
Link: https://access.redhat.com/discussions/3434091
Fixes: 01d37c428ae0 ("SUNRPC: xprt_connect() don't abort the task if the transport isn't bound")
Signed-off-by: NeilBrown <neilb@suse.de>
---
 net/sunrpc/xprtsock.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Benjamin Coddington Oct. 9, 2024, 10:26 a.m. UTC | #1
On 9 Oct 2024, at 1:28, NeilBrown wrote:

> xs_tcp_finish_connecting() can return -ENOTCONN but the switch statement
> in xs_tcp_setup_socket() treats that as an unhandled error.
>
> If we treat it as a known error it would propagate back to
> call_connect_status() which does handle that error code.  This appears
> to be the intention of the commit (given below) which added -ENOTCONN as
> a return status for xs_tcp_finish_connecting().
>
> So add -ENOTCONN to the switch statement as an error to pass through to
> the caller.
>
> Link: https://bugzilla.suse.com/show_bug.cgi?id=1231050
> Link: https://access.redhat.com/discussions/3434091
> Fixes: 01d37c428ae0 ("SUNRPC: xprt_connect() don't abort the task if the transport isn't bound")
> Signed-off-by: NeilBrown <neilb@suse.de>

Thanks!  We should have chased this down ages ago..

Reviewed-by: Benjamin Coddington <bcodding@redhat.com>

Ben
NeilBrown Nov. 4, 2024, 5:51 a.m. UTC | #2
On Wed, 09 Oct 2024, Benjamin Coddington wrote:
> On 9 Oct 2024, at 1:28, NeilBrown wrote:
> 
> > xs_tcp_finish_connecting() can return -ENOTCONN but the switch statement
> > in xs_tcp_setup_socket() treats that as an unhandled error.
> >
> > If we treat it as a known error it would propagate back to
> > call_connect_status() which does handle that error code.  This appears
> > to be the intention of the commit (given below) which added -ENOTCONN as
> > a return status for xs_tcp_finish_connecting().
> >
> > So add -ENOTCONN to the switch statement as an error to pass through to
> > the caller.
> >
> > Link: https://bugzilla.suse.com/show_bug.cgi?id=1231050
> > Link: https://access.redhat.com/discussions/3434091
> > Fixes: 01d37c428ae0 ("SUNRPC: xprt_connect() don't abort the task if the transport isn't bound")
> > Signed-off-by: NeilBrown <neilb@suse.de>
> 
> Thanks!  We should have chased this down ages ago..
> 
> Reviewed-by: Benjamin Coddington <bcodding@redhat.com>

Thanks Ben.

Trond, Anna: have you had a chance to look at this yet?

Thanks,
NeilBrown
diff mbox series

Patch

diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 0e1691316f42..1326fbf45a34 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2459,6 +2459,7 @@  static void xs_tcp_setup_socket(struct work_struct *work)
 	case -EHOSTUNREACH:
 	case -EADDRINUSE:
 	case -ENOBUFS:
+	case -ENOTCONN:
 		break;
 	default:
 		printk("%s: connect returned unhandled error %d\n",