From: Max Gurtovoy <mgurtovoy@nvidia.com>
To: <linux-rdma@vger.kernel.org>, <jgg@nvidia.com>, <sagi@grimberg.me>
Cc: <oren@nvidia.com>, <sergeygo@nvidia.com>, <israelr@nvidia.com>,
<leonro@nvidia.com>, Max Gurtovoy <mgurtovoy@nvidia.com>
Subject: [PATCH v2 4/4] IB/iser: fix error flow in case of registration failure
Date: Tue, 8 Mar 2022 16:55:46 +0200 [thread overview]
Message-ID: <20220308145546.8372-5-mgurtovoy@nvidia.com> (raw)
In-Reply-To: <20220308145546.8372-1-mgurtovoy@nvidia.com>
During READ/WRITE preparation, in case of failure in memory registration
using iser_reg_mem_fastreg we must unmap previously mapped iser task.
Reviewed-by: Sergey Gorenko <sergeygo@nvidia.com>
Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
---
drivers/infiniband/ulp/iser/iser_initiator.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index dbc2c268bc0e..bd5f3b5e1727 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -62,7 +62,7 @@ static int iser_prepare_read_cmd(struct iscsi_task *task)
err = iser_reg_mem_fastreg(iser_task, ISER_DIR_IN, false);
if (err) {
iser_err("Failed to set up Data-IN RDMA\n");
- return err;
+ goto out_err;
}
mem_reg = &iser_task->rdma_reg[ISER_DIR_IN];
@@ -75,6 +75,10 @@ static int iser_prepare_read_cmd(struct iscsi_task *task)
(unsigned long long)mem_reg->sge.addr);
return 0;
+
+out_err:
+ iser_dma_unmap_task_data(iser_task, ISER_DIR_IN, DMA_FROM_DEVICE);
+ return err;
}
/* Register user buffer memory and initialize passive rdma
@@ -100,9 +104,9 @@ static int iser_prepare_write_cmd(struct iscsi_task *task, unsigned int imm_sz,
err = iser_reg_mem_fastreg(iser_task, ISER_DIR_OUT,
buf_out->data_len == imm_sz);
- if (err != 0) {
+ if (err) {
iser_err("Failed to register write cmd RDMA mem\n");
- return err;
+ goto out_err;
}
mem_reg = &iser_task->rdma_reg[ISER_DIR_OUT];
@@ -129,6 +133,10 @@ static int iser_prepare_write_cmd(struct iscsi_task *task, unsigned int imm_sz,
}
return 0;
+
+out_err:
+ iser_dma_unmap_task_data(iser_task, ISER_DIR_OUT, DMA_TO_DEVICE);
+ return err;
}
/* creates a new tx descriptor and adds header regd buffer */
--
2.18.1
next prev parent reply other threads:[~2022-03-08 14:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-08 14:55 [PATCH v2 0/4] iSER cleanups and fixes for 5.18 Max Gurtovoy
2022-03-08 14:55 ` [PATCH v2 1/4] IB/iser: remove iser_reg_data_sg helper function Max Gurtovoy
2022-03-16 15:06 ` Sagi Grimberg
2022-03-08 14:55 ` [PATCH v2 2/4] IB/iser: use iser_fr_desc as registration context Max Gurtovoy
2022-03-16 15:09 ` Sagi Grimberg
2022-03-08 14:55 ` [PATCH v2 3/4] IB/iser: generalize map/unmap dma tasks Max Gurtovoy
2022-03-16 15:13 ` Sagi Grimberg
2022-03-08 14:55 ` Max Gurtovoy [this message]
2022-03-16 15:14 ` [PATCH v2 4/4] IB/iser: fix error flow in case of registration failure Sagi Grimberg
2022-03-16 16:02 ` Max Gurtovoy
2022-03-17 7:31 ` Sagi Grimberg
2022-03-18 18:19 ` [PATCH v2 0/4] iSER cleanups and fixes for 5.18 Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220308145546.8372-5-mgurtovoy@nvidia.com \
--to=mgurtovoy@nvidia.com \
--cc=israelr@nvidia.com \
--cc=jgg@nvidia.com \
--cc=leonro@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=oren@nvidia.com \
--cc=sagi@grimberg.me \
--cc=sergeygo@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.