• NeilBrown's avatar
    SUNRPC: ensure correct error is reported by xs_tcp_setup_socket() · 6ea44adc
    NeilBrown authored
    If you attempt a TCP mount from an host that is unreachable in a way
    that triggers an immediate error from kernel_connect(), that error
    does not propagate up, instead EAGAIN is reported.
    
    This results in call_connect_status receiving the wrong error.
    
    A case that it easy to demonstrate is to attempt to mount from an
    address that results in ENETUNREACH, but first deleting any default
    route.
    Without this patch, the mount.nfs process is persistently runnable
    and is hard to kill.  With this patch it exits as it should.
    
    The problem is caused by the fact that xs_tcp_force_close() eventually
    calls
          xprt_wake_pending_tasks(xprt, -EAGAIN);
    which causes an error return of -EAGAIN.  so when xs_tcp_setup_sock()
    calls
          xprt_wake_pending_tasks(xprt, status);
    the status is ignored.
    
    Fixes: 4efdd92c ("SUNRPC: Remove TCP client connection reset hack")
    Signed-off-by: default avatarNeilBrown <neilb@suse.com>
    Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
    6ea44adc
xprtsock.c 86.7 KB