All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] nvme-multipath: split bios with the ns_head bio_set before submitting
@ 2019-04-30 16:27 Hannes Reinecke
  2019-04-30 16:33 ` Keith Busch
  0 siblings, 1 reply; 3+ messages in thread
From: Hannes Reinecke @ 2019-04-30 16:27 UTC (permalink / raw)


If the bio is moved to a different queue via blk_steal_bios() and
the original queue is destroyed in nvme_remove_ns() we'll be ending
with a crash in bio_endio() as the mempool for the split bio bvecs
had already been destroyed.
So split the bio using the original queue (which will remain during the
lifetime of the bio) before sending it down to the underlying device.

Signed-off-by: Hannes Reinecke <hare at suse.com>
---
 drivers/nvme/host/multipath.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 2551264ef2b5..e13e960a7139 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -232,6 +232,14 @@ static blk_qc_t nvme_ns_head_make_request(struct request_queue *q,
 	blk_qc_t ret = BLK_QC_T_NONE;
 	int srcu_idx;
 
+	/*
+	 * The namespace might be going away and the bio might
+	 * be moved to a different queue via blk_steal_bios(),
+	 * so we need to use the bio_split pool from the original
+	 * queue to allocate the bvecs from.
+	 */
+	blk_queue_split(q, *bio);
+
 	srcu_idx = srcu_read_lock(&head->srcu);
 	ns = nvme_find_path(head);
 	if (likely(ns)) {
-- 
2.16.4

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

* [PATCHv2] nvme-multipath: split bios with the ns_head bio_set before submitting
  2019-04-30 16:27 [PATCHv2] nvme-multipath: split bios with the ns_head bio_set before submitting Hannes Reinecke
@ 2019-04-30 16:33 ` Keith Busch
  2019-04-30 16:53   ` Hannes Reinecke
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Busch @ 2019-04-30 16:33 UTC (permalink / raw)


On Tue, Apr 30, 2019@06:27:45PM +0200, Hannes Reinecke wrote:
> +	/*
> +	 * The namespace might be going away and the bio might
> +	 * be moved to a different queue via blk_steal_bios(),
> +	 * so we need to use the bio_split pool from the original
> +	 * queue to allocate the bvecs from.
> +	 */
> +	blk_queue_split(q, *bio);
                           ^^^^

Shouldn't that be '&bio'?

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

* [PATCHv2] nvme-multipath: split bios with the ns_head bio_set before submitting
  2019-04-30 16:33 ` Keith Busch
@ 2019-04-30 16:53   ` Hannes Reinecke
  0 siblings, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2019-04-30 16:53 UTC (permalink / raw)


On 4/30/19 6:33 PM, Keith Busch wrote:
> On Tue, Apr 30, 2019@06:27:45PM +0200, Hannes Reinecke wrote:
>> +	/*
>> +	 * The namespace might be going away and the bio might
>> +	 * be moved to a different queue via blk_steal_bios(),
>> +	 * so we need to use the bio_split pool from the original
>> +	 * queue to allocate the bvecs from.
>> +	 */
>> +	blk_queue_split(q, *bio);
>                             ^^^^
> 
> Shouldn't that be '&bio'?
> 
Lemme check ...

/me cross-checks the build logs

and indeed, you are correct.

Will be resending.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke            Teamlead Storage & Networking
hare at suse.de                              +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG N?rnberg)

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

end of thread, other threads:[~2019-04-30 16:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-30 16:27 [PATCHv2] nvme-multipath: split bios with the ns_head bio_set before submitting Hannes Reinecke
2019-04-30 16:33 ` Keith Busch
2019-04-30 16:53   ` Hannes Reinecke

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.