Skip to content

Commit bd7baa5

Browse files
metze-sambaopsiff
authored andcommitted
smb: client: let recv_done() cleanup before notifying the callers.
[ Upstream commit bdd7afc6dca5e0ebbb75583484aa6ea9e03fbb13 ] We should call put_receive_buffer() before waking up the callers. For the internal error case of response->type being unexpected, we now also call smbd_disconnect_rdma_connection() instead of not waking up the callers at all. Note that the SMBD_TRANSFER_DATA case still has problems, which will be addressed in the next commit in order to make it easier to review this one. Cc: Steve French <[email protected]> Cc: Tom Talpey <[email protected]> Cc: Long Li <[email protected]> Cc: [email protected] Cc: [email protected] Fixes: f198186 ("CIFS: SMBD: Establish SMB Direct connection") Signed-off-by: Stefan Metzmacher <[email protected]> Signed-off-by: Steve French <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit 4e5cf39e4064570022d2dd2ad29de002e7a66d68)
1 parent a21ddfa commit bd7baa5

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

fs/smb/client/smbdirect.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
465465
if (wc->status != IB_WC_SUCCESS || wc->opcode != IB_WC_RECV) {
466466
log_rdma_recv(INFO, "wc->status=%d opcode=%d\n",
467467
wc->status, wc->opcode);
468-
smbd_disconnect_rdma_connection(info);
469468
goto error;
470469
}
471470

@@ -482,8 +481,9 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
482481
info->full_packet_received = true;
483482
info->negotiate_done =
484483
process_negotiation_response(response, wc->byte_len);
484+
put_receive_buffer(info, response);
485485
complete(&info->negotiate_completion);
486-
break;
486+
return;
487487

488488
/* SMBD data transfer packet */
489489
case SMBD_TRANSFER_DATA:
@@ -540,14 +540,16 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
540540
}
541541

542542
return;
543-
544-
default:
545-
log_rdma_recv(ERR,
546-
"unexpected response type=%d\n", response->type);
547543
}
548544

545+
/*
546+
* This is an internal error!
547+
*/
548+
log_rdma_recv(ERR, "unexpected response type=%d\n", response->type);
549+
WARN_ON_ONCE(response->type != SMBD_TRANSFER_DATA);
549550
error:
550551
put_receive_buffer(info, response);
552+
smbd_disconnect_rdma_connection(info);
551553
}
552554

553555
static struct rdma_cm_id *smbd_create_id(

0 commit comments

Comments
 (0)