* [PATCH] smb: server: Use common error handling code in smb_direct_rdma_xmit()
@ 2025-10-01 19:25 Markus Elfring
2025-10-02 12:30 ` Stefan Metzmacher
0 siblings, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2025-10-01 19:25 UTC (permalink / raw)
To: linux-cifs, Hyunchul Lee, Namjae Jeon, Sergey Senozhatsky,
Steve French, Tom Talpey
Cc: LKML, kernel-janitors, Stefan Metzmacher
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 1 Oct 2025 21:09:00 +0200
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>
---
fs/smb/server/transport_rdma.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/fs/smb/server/transport_rdma.c b/fs/smb/server/transport_rdma.c
index b3077766d6ec..a201c5871a77 100644
--- a/fs/smb/server/transport_rdma.c
+++ b/fs/smb/server/transport_rdma.c
@@ -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,
--
2.51.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] smb: server: Use common error handling code in smb_direct_rdma_xmit()
2025-10-01 19:25 [PATCH] smb: server: Use common error handling code in smb_direct_rdma_xmit() Markus Elfring
@ 2025-10-02 12:30 ` Stefan Metzmacher
2025-10-02 13:57 ` Namjae Jeon
2025-10-02 15:14 ` Steve French
0 siblings, 2 replies; 4+ messages in thread
From: Stefan Metzmacher @ 2025-10-02 12:30 UTC (permalink / raw)
To: Markus Elfring, linux-cifs, Hyunchul Lee, Namjae Jeon,
Sergey Senozhatsky, Steve French, Tom Talpey
Cc: LKML, kernel-janitors
Hi Markus,
> 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>
I'll add this to my for-6.19/fs-smb branch and rebase on top
of it as this function will move to another file there.
Namjae, Steve: this can also be pushed to 6.18 if you want.
Thanks!
metze
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] smb: server: Use common error handling code in smb_direct_rdma_xmit()
2025-10-02 12:30 ` Stefan Metzmacher
@ 2025-10-02 13:57 ` Namjae Jeon
2025-10-02 15:14 ` Steve French
1 sibling, 0 replies; 4+ messages in thread
From: Namjae Jeon @ 2025-10-02 13:57 UTC (permalink / raw)
To: Stefan Metzmacher
Cc: Markus Elfring, linux-cifs, Hyunchul Lee, Sergey Senozhatsky,
Steve French, Tom Talpey, LKML, kernel-janitors
On Thu, Oct 2, 2025 at 9:31 PM Stefan Metzmacher <metze@samba.org> wrote:
>
> Hi Markus,
>
> > 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>
>
> I'll add this to my for-6.19/fs-smb branch and rebase on top
> of it as this function will move to another file there.
>
> Namjae, Steve: this can also be pushed to 6.18 if you want.
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Steve, Please add this patch to #ksmbd-for-next.
Thanks.
>
> Thanks!
> metze
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] smb: server: Use common error handling code in smb_direct_rdma_xmit()
2025-10-02 12:30 ` Stefan Metzmacher
2025-10-02 13:57 ` Namjae Jeon
@ 2025-10-02 15:14 ` Steve French
1 sibling, 0 replies; 4+ messages in thread
From: Steve French @ 2025-10-02 15:14 UTC (permalink / raw)
To: Stefan Metzmacher
Cc: Markus Elfring, linux-cifs, Hyunchul Lee, Namjae Jeon,
Sergey Senozhatsky, Tom Talpey, LKML, kernel-janitors
Added to ksmbd-for-next
On Thu, Oct 2, 2025 at 7:31 AM Stefan Metzmacher <metze@samba.org> wrote:
>
> Hi Markus,
>
> > 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>
>
> I'll add this to my for-6.19/fs-smb branch and rebase on top
> of it as this function will move to another file there.
>
> Namjae, Steve: this can also be pushed to 6.18 if you want.
>
> Thanks!
> metze
>
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-02 15:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-01 19:25 [PATCH] smb: server: Use common error handling code in smb_direct_rdma_xmit() Markus Elfring
2025-10-02 12:30 ` Stefan Metzmacher
2025-10-02 13:57 ` Namjae Jeon
2025-10-02 15:14 ` Steve French
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®