All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-fc: use blk_rq_nr_phys_segments
@ 2017-01-19 15:55 Christoph Hellwig
  2017-01-25  8:46 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christoph Hellwig @ 2017-01-19 15:55 UTC (permalink / raw)


Without this deallocate won't work properly due to the mismatch
of the bio/request size and the actual payload size.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/fc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index fcc9dcf..e65041c 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -1663,13 +1663,13 @@ nvme_fc_map_data(struct nvme_fc_ctrl *ctrl, struct request *rq,
 		return 0;
 
 	freq->sg_table.sgl = freq->first_sgl;
-	ret = sg_alloc_table_chained(&freq->sg_table, rq->nr_phys_segments,
-			freq->sg_table.sgl);
+	ret = sg_alloc_table_chained(&freq->sg_table,
+			blk_rq_nr_phys_segments(rq), freq->sg_table.sgl);
 	if (ret)
 		return -ENOMEM;
 
 	op->nents = blk_rq_map_sg(rq->q, rq, freq->sg_table.sgl);
-	WARN_ON(op->nents > rq->nr_phys_segments);
+	WARN_ON(op->nents > blk_rq_nr_phys_segments(rq));
 	dir = (rq_data_dir(rq) == WRITE) ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
 	freq->sg_cnt = fc_dma_map_sg(ctrl->lport->dev, freq->sg_table.sgl,
 				op->nents, dir);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] nvme-fc: use blk_rq_nr_phys_segments
  2017-01-19 15:55 [PATCH] nvme-fc: use blk_rq_nr_phys_segments Christoph Hellwig
@ 2017-01-25  8:46 ` Christoph Hellwig
  2017-01-25  8:58 ` Johannes Thumshirn
  2017-01-25 17:14 ` James Smart
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2017-01-25  8:46 UTC (permalink / raw)


Folks, can I get a review fore this?

Without it we'll reliably crash on a discard on nvme-fc, so we
should get this into 4.10.

On Thu, Jan 19, 2017@04:55:57PM +0100, Christoph Hellwig wrote:
> Without this deallocate won't work properly due to the mismatch
> of the bio/request size and the actual payload size.
> 
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
>  drivers/nvme/host/fc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
> index fcc9dcf..e65041c 100644
> --- a/drivers/nvme/host/fc.c
> +++ b/drivers/nvme/host/fc.c
> @@ -1663,13 +1663,13 @@ nvme_fc_map_data(struct nvme_fc_ctrl *ctrl, struct request *rq,
>  		return 0;
>  
>  	freq->sg_table.sgl = freq->first_sgl;
> -	ret = sg_alloc_table_chained(&freq->sg_table, rq->nr_phys_segments,
> -			freq->sg_table.sgl);
> +	ret = sg_alloc_table_chained(&freq->sg_table,
> +			blk_rq_nr_phys_segments(rq), freq->sg_table.sgl);
>  	if (ret)
>  		return -ENOMEM;
>  
>  	op->nents = blk_rq_map_sg(rq->q, rq, freq->sg_table.sgl);
> -	WARN_ON(op->nents > rq->nr_phys_segments);
> +	WARN_ON(op->nents > blk_rq_nr_phys_segments(rq));
>  	dir = (rq_data_dir(rq) == WRITE) ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
>  	freq->sg_cnt = fc_dma_map_sg(ctrl->lport->dev, freq->sg_table.sgl,
>  				op->nents, dir);
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
---end quoted text---

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] nvme-fc: use blk_rq_nr_phys_segments
  2017-01-19 15:55 [PATCH] nvme-fc: use blk_rq_nr_phys_segments Christoph Hellwig
  2017-01-25  8:46 ` Christoph Hellwig
@ 2017-01-25  8:58 ` Johannes Thumshirn
  2017-01-25 17:14 ` James Smart
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2017-01-25  8:58 UTC (permalink / raw)


On Thu, Jan 19, 2017@04:55:57PM +0100, Christoph Hellwig wrote:
> Without this deallocate won't work properly due to the mismatch
> of the bio/request size and the actual payload size.
> 
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---

Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de>

Might be worth adding a:
Fixes: f9d03f96b ('block: improve handling of the magic discard payload')
as well.

-- 
Johannes Thumshirn                                          Storage
jthumshirn at suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] nvme-fc: use blk_rq_nr_phys_segments
  2017-01-19 15:55 [PATCH] nvme-fc: use blk_rq_nr_phys_segments Christoph Hellwig
  2017-01-25  8:46 ` Christoph Hellwig
  2017-01-25  8:58 ` Johannes Thumshirn
@ 2017-01-25 17:14 ` James Smart
  2 siblings, 0 replies; 4+ messages in thread
From: James Smart @ 2017-01-25 17:14 UTC (permalink / raw)


On 1/19/2017 7:55 AM, Christoph Hellwig wrote:
> Without this deallocate won't work properly due to the mismatch
> of the bio/request size and the actual payload size.
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
>   

looks fine to me.

Reviewed-by: James Smart <james.smart at broadcom.com>

-- james

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-25 17:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-19 15:55 [PATCH] nvme-fc: use blk_rq_nr_phys_segments Christoph Hellwig
2017-01-25  8:46 ` Christoph Hellwig
2017-01-25  8:58 ` Johannes Thumshirn
2017-01-25 17:14 ` James Smart

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.