* [PATCH v1 14/19] nvme-rdma: Fix error check for ib_dma_map_sg
[not found] <20220819060801.10443-1-jinpu.wang@ionos.com>
@ 2022-08-19 6:07 ` Jack Wang
2022-08-21 5:57 ` Christoph Hellwig
2022-08-19 6:07 ` [PATCH v1 15/19] nvme-fc: Fix the error check for dma_map_sg Jack Wang
1 sibling, 1 reply; 6+ messages in thread
From: Jack Wang @ 2022-08-19 6:07 UTC (permalink / raw)
To: linux-kernel
Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
linux-nvme
ib_dma_map_sg return 0 on error.
Cc: Keith Busch <kbusch@kernel.org>
Cc: Jens Axboe <axboe@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: linux-nvme@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
---
drivers/nvme/host/rdma.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 3100643be299..d70bccbcba3e 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1551,7 +1551,7 @@ static int nvme_rdma_dma_map_req(struct ib_device *ibdev, struct request *rq,
*count = ib_dma_map_sg(ibdev, req->data_sgl.sg_table.sgl,
req->data_sgl.nents, rq_dma_dir(rq));
- if (unlikely(*count <= 0)) {
+ if (unlikely(!*count)) {
ret = -EIO;
goto out_free_table;
}
@@ -1574,7 +1574,7 @@ static int nvme_rdma_dma_map_req(struct ib_device *ibdev, struct request *rq,
req->metadata_sgl->sg_table.sgl,
req->metadata_sgl->nents,
rq_dma_dir(rq));
- if (unlikely(*pi_count <= 0)) {
+ if (unlikely(!*pi_count)) {
ret = -EIO;
goto out_free_pi_table;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v1 15/19] nvme-fc: Fix the error check for dma_map_sg
[not found] <20220819060801.10443-1-jinpu.wang@ionos.com>
2022-08-19 6:07 ` [PATCH v1 14/19] nvme-rdma: Fix error check for ib_dma_map_sg Jack Wang
@ 2022-08-19 6:07 ` Jack Wang
1 sibling, 0 replies; 6+ messages in thread
From: Jack Wang @ 2022-08-19 6:07 UTC (permalink / raw)
To: linux-kernel
Cc: James Smart, Keith Busch, Jens Axboe, Christoph Hellwig,
Sagi Grimberg, linux-nvme
dma_map_sg return 0 on error, add missing check.
Cc: James Smart <james.smart@broadcom.com>
Cc: Keith Busch <kbusch@kernel.org>
Cc: Jens Axboe <axboe@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: linux-nvme@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
---
drivers/nvme/host/fc.c | 2 +-
drivers/nvme/target/fc.c | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 127abaf9ba5d..95050f2e0a06 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -2616,7 +2616,7 @@ nvme_fc_map_data(struct nvme_fc_ctrl *ctrl, struct request *rq,
WARN_ON(op->nents > blk_rq_nr_phys_segments(rq));
freq->sg_cnt = fc_dma_map_sg(ctrl->lport->dev, freq->sg_table.sgl,
op->nents, rq_dma_dir(rq));
- if (unlikely(freq->sg_cnt <= 0)) {
+ if (unlikely(!freq->sg_cnt)) {
sg_free_table_chained(&freq->sg_table, NVME_INLINE_SG_CNT);
freq->sg_cnt = 0;
return -EFAULT;
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index ab2627e17bb9..3749ca28860b 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -2089,6 +2089,11 @@ nvmet_fc_alloc_tgt_pgs(struct nvmet_fc_fcp_iod *fod)
((fod->io_dir == NVMET_FCP_WRITE) ?
DMA_FROM_DEVICE : DMA_TO_DEVICE));
/* note: write from initiator perspective */
+ if (!fod->data_sg_cnt) {
+ sgl_free(fod->data_sg);
+ fod->data_sg = NULL;
+ goto out;
+ }
fod->next_sg = fod->data_sg;
return 0;
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1 14/19] nvme-rdma: Fix error check for ib_dma_map_sg
2022-08-19 6:07 ` [PATCH v1 14/19] nvme-rdma: Fix error check for ib_dma_map_sg Jack Wang
@ 2022-08-21 5:57 ` Christoph Hellwig
2022-08-22 5:12 ` Jinpu Wang
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2022-08-21 5:57 UTC (permalink / raw)
To: Jack Wang
Cc: linux-kernel, Keith Busch, Jens Axboe, Christoph Hellwig,
Sagi Grimberg, linux-nvme
Please don't send me just two random patches out of a series, as I
have no way to review them. If the patches are independent, send them
independently and if they depend on common prep work send the entire
series to everyone.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 14/19] nvme-rdma: Fix error check for ib_dma_map_sg
2022-08-21 5:57 ` Christoph Hellwig
@ 2022-08-22 5:12 ` Jinpu Wang
2022-08-22 6:25 ` Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: Jinpu Wang @ 2022-08-22 5:12 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-kernel, Keith Busch, Jens Axboe, Sagi Grimberg, linux-nvme
On Sun, Aug 21, 2022 at 7:57 AM Christoph Hellwig <hch@lst.de> wrote:
>
> Please don't send me just two random patches out of a series, as I
> have no way to review them. If the patches are independent, send them
> independently and if they depend on common prep work send the entire
> series to everyone.
Hi Christoph,
As mentioned in the cover letter, the bugfixes are all independent,
for each of the drivers.
I will wait a bit to see if there is other comments, resend as you
suggested later.
Thx!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 14/19] nvme-rdma: Fix error check for ib_dma_map_sg
2022-08-22 5:12 ` Jinpu Wang
@ 2022-08-22 6:25 ` Christoph Hellwig
2022-08-22 7:10 ` Jinpu Wang
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2022-08-22 6:25 UTC (permalink / raw)
To: Jinpu Wang
Cc: Christoph Hellwig, linux-kernel, Keith Busch, Jens Axboe,
Sagi Grimberg, linux-nvme
On Mon, Aug 22, 2022 at 07:12:23AM +0200, Jinpu Wang wrote:
> On Sun, Aug 21, 2022 at 7:57 AM Christoph Hellwig <hch@lst.de> wrote:
> >
> > Please don't send me just two random patches out of a series, as I
> > have no way to review them. If the patches are independent, send them
> > independently and if they depend on common prep work send the entire
> > series to everyone.
> Hi Christoph,
>
> As mentioned in the cover letter, the bugfixes are all independent,
> for each of the drivers.
I still haven't seen the cover letter as it was never sent to me.
But if patches are independent please send a series per subsystem
as that makes that very clear.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 14/19] nvme-rdma: Fix error check for ib_dma_map_sg
2022-08-22 6:25 ` Christoph Hellwig
@ 2022-08-22 7:10 ` Jinpu Wang
0 siblings, 0 replies; 6+ messages in thread
From: Jinpu Wang @ 2022-08-22 7:10 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-kernel, Keith Busch, Jens Axboe, Sagi Grimberg, linux-nvme
On Mon, Aug 22, 2022 at 8:25 AM Christoph Hellwig <hch@lst.de> wrote:
>
> On Mon, Aug 22, 2022 at 07:12:23AM +0200, Jinpu Wang wrote:
> > On Sun, Aug 21, 2022 at 7:57 AM Christoph Hellwig <hch@lst.de> wrote:
> > >
> > > Please don't send me just two random patches out of a series, as I
> > > have no way to review them. If the patches are independent, send them
> > > independently and if they depend on common prep work send the entire
> > > series to everyone.
> > Hi Christoph,
> >
> > As mentioned in the cover letter, the bugfixes are all independent,
> > for each of the drivers.
>
> I still haven't seen the cover letter as it was never sent to me.
> But if patches are independent please send a series per subsystem
> as that makes that very clear.
Thanks for the hint, this definitely helps the subsystem maintainer to
get a clear background.
I'll do it in the future.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-08-22 7:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20220819060801.10443-1-jinpu.wang@ionos.com>
2022-08-19 6:07 ` [PATCH v1 14/19] nvme-rdma: Fix error check for ib_dma_map_sg Jack Wang
2022-08-21 5:57 ` Christoph Hellwig
2022-08-22 5:12 ` Jinpu Wang
2022-08-22 6:25 ` Christoph Hellwig
2022-08-22 7:10 ` Jinpu Wang
2022-08-19 6:07 ` [PATCH v1 15/19] nvme-fc: Fix the error check for dma_map_sg Jack Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox