mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 14:12:07 +02:00
smb: server: Use common error handling code in smb_direct_rdma_xmit()
Add two jump targets so that a bit of exception handling can be better reused at the end of this function implementation. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Reviewed-by: Stefan Metzmacher <metze@samba.org> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
3a86608788
commit
39dec6cd88
|
|
@ -1574,18 +1574,14 @@ static int smb_direct_rdma_xmit(struct smb_direct_transport *t,
|
|||
get_buf_page_count(desc_buf, desc_buf_len),
|
||||
msg->sg_list, SG_CHUNK_SIZE);
|
||||
if (ret) {
|
||||
kfree(msg);
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
goto free_msg;
|
||||
}
|
||||
|
||||
ret = get_sg_list(desc_buf, desc_buf_len,
|
||||
msg->sgt.sgl, msg->sgt.orig_nents);
|
||||
if (ret < 0) {
|
||||
sg_free_table_chained(&msg->sgt, SG_CHUNK_SIZE);
|
||||
kfree(msg);
|
||||
goto out;
|
||||
}
|
||||
if (ret < 0)
|
||||
goto free_table;
|
||||
|
||||
ret = rdma_rw_ctx_init(&msg->rdma_ctx, sc->ib.qp, sc->ib.qp->port,
|
||||
msg->sgt.sgl,
|
||||
|
|
@ -1596,9 +1592,7 @@ static int smb_direct_rdma_xmit(struct smb_direct_transport *t,
|
|||
is_read ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
|
||||
if (ret < 0) {
|
||||
pr_err("failed to init rdma_rw_ctx: %d\n", ret);
|
||||
sg_free_table_chained(&msg->sgt, SG_CHUNK_SIZE);
|
||||
kfree(msg);
|
||||
goto out;
|
||||
goto free_table;
|
||||
}
|
||||
|
||||
list_add_tail(&msg->list, &msg_list);
|
||||
|
|
@ -1630,6 +1624,12 @@ static int smb_direct_rdma_xmit(struct smb_direct_transport *t,
|
|||
atomic_add(credits_needed, &sc->rw_io.credits.count);
|
||||
wake_up(&sc->rw_io.credits.wait_queue);
|
||||
return ret;
|
||||
|
||||
free_table:
|
||||
sg_free_table_chained(&msg->sgt, SG_CHUNK_SIZE);
|
||||
free_msg:
|
||||
kfree(msg);
|
||||
goto out;
|
||||
}
|
||||
|
||||
static int smb_direct_rdma_write(struct ksmbd_transport *t,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user