If smbdirect_connection_send_single_iter() got the last send credit and has no recv credits to grant, it waits for the refill work or for the peer to grant new credits. If that wait failed, it jumped to credit_failed, which only gives back the local credit, so the send credit it already took was lost. As it was the last send credit, sc->send_io.credits.count stays at 0, so every following send waits until the connection is torn down, e.g. by the keepalive timeout. Jump to alloc_failed instead, which also gives back the send credit. Fixes: 93ac432274e1 ("smb: client: fix last send credit problem causing disconnects") Cc: stable@vger.kernel.org Cc: Namjae Jeon Cc: Paulo Alcantara Cc: Tom Talpey Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Signed-off-by: Stefan Metzmacher --- fs/smb/smbdirect/connection.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/smb/smbdirect/connection.c b/fs/smb/smbdirect/connection.c index e375584ab447..c50096e605ee 100644 --- a/fs/smb/smbdirect/connection.c +++ b/fs/smb/smbdirect/connection.c @@ -1184,8 +1184,9 @@ int smbdirect_connection_send_single_iter(struct smbdirect_socket *sc, sc->status != SMBDIRECT_SOCKET_CONNECTED); if (sc->status != SMBDIRECT_SOCKET_CONNECTED) ret = -ENOTCONN; + /* we already have a send credit to give back */ if (ret < 0) - goto credit_failed; + goto alloc_failed; new_credits = smbdirect_connection_grant_recv_credits(sc); } -- 2.43.0