Skip to content

Commit bdd7afc

Browse files
metze-sambasmfrench
authored andcommitted
smb: client: let recv_done() cleanup before notifying the callers.
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 <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: Long Li <longli@microsoft.com> Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Fixes: f198186 ("CIFS: SMBD: Establish SMB Direct connection") Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 047682c commit bdd7afc

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

fs/smb/client/smbdirect.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,6 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
454454
if (wc->status != IB_WC_SUCCESS || wc->opcode != IB_WC_RECV) {
455455
log_rdma_recv(INFO, "wc->status=%d opcode=%d\n",
456456
wc->status, wc->opcode);
457-
smbd_disconnect_rdma_connection(info);
458457
goto error;
459458
}
460459

@@ -471,8 +470,9 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
471470
info->full_packet_received = true;
472471
info->negotiate_done =
473472
process_negotiation_response(response, wc->byte_len);
473+
put_receive_buffer(info, response);
474474
complete(&info->negotiate_completion);
475-
break;
475+
return;
476476

477477
/* SMBD data transfer packet */
478478
case SMBD_TRANSFER_DATA:
@@ -529,14 +529,16 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
529529
}
530530

531531
return;
532-
533-
default:
534-
log_rdma_recv(ERR,
535-
"unexpected response type=%d\n", response->type);
536532
}
537533

534+
/*
535+
* This is an internal error!
536+
*/
537+
log_rdma_recv(ERR, "unexpected response type=%d\n", response->type);
538+
WARN_ON_ONCE(response->type != SMBD_TRANSFER_DATA);
538539
error:
539540
put_receive_buffer(info, response);
541+
smbd_disconnect_rdma_connection(info);
540542
}
541543

542544
static struct rdma_cm_id *smbd_create_id(

0 commit comments

Comments
 (0)