linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: Fix cloning of requests with a special payload
@ 2018-06-27 19:55 Bart Van Assche
  2018-06-27 23:41 ` Ming Lei
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Bart Van Assche @ 2018-06-27 19:55 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Christoph Hellwig, Bart Van Assche, Mike Snitzer,
	Ming Lei, Hannes Reinecke, Johannes Thumshirn, stable

This patch avoids that removing a path controlled by the dm-mpath driver
while mkfs is running triggers the following kernel bug:

    kernel BUG at block/blk-core.c:3347!
    invalid opcode: 0000 [#1] PREEMPT SMP KASAN
    CPU: 20 PID: 24369 Comm: mkfs.ext4 Not tainted 4.18.0-rc1-dbg+ #2
    RIP: 0010:blk_end_request_all+0x68/0x70
    Call Trace:
     <IRQ>
     dm_softirq_done+0x326/0x3d0 [dm_mod]
     blk_done_softirq+0x19b/0x1e0
     __do_softirq+0x128/0x60d
     irq_exit+0x100/0x110
     smp_call_function_single_interrupt+0x90/0x330
     call_function_single_interrupt+0xf/0x20
     </IRQ>

Fixes: f9d03f96b988 ("block: improve handling of the magic discard payload")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Cc: <stable@vger.kernel.org>
---
 block/blk-core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/block/blk-core.c b/block/blk-core.c
index 118dd17eb71f..f1e07ed1513c 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -3529,6 +3529,10 @@ static void __blk_rq_prep_clone(struct request *dst, struct request *src)
 	dst->cpu = src->cpu;
 	dst->__sector = blk_rq_pos(src);
 	dst->__data_len = blk_rq_bytes(src);
+	if (src->rq_flags & RQF_SPECIAL_PAYLOAD) {
+		dst->rq_flags |= RQF_SPECIAL_PAYLOAD;
+		dst->special_vec = src->special_vec;
+	}
 	dst->nr_phys_segments = src->nr_phys_segments;
 	dst->ioprio = src->ioprio;
 	dst->extra_len = src->extra_len;
-- 
2.17.1

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

* Re: [PATCH] block: Fix cloning of requests with a special payload
  2018-06-27 19:55 [PATCH] block: Fix cloning of requests with a special payload Bart Van Assche
@ 2018-06-27 23:41 ` Ming Lei
  2018-06-27 23:43   ` Bart Van Assche
  2018-06-28 14:31 ` Christoph Hellwig
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Ming Lei @ 2018-06-27 23:41 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Mike Snitzer,
	Hannes Reinecke, Johannes Thumshirn, stable

On Wed, Jun 27, 2018 at 12:55:18PM -0700, Bart Van Assche wrote:
> This patch avoids that removing a path controlled by the dm-mpath driver
> while mkfs is running triggers the following kernel bug:
> 
>     kernel BUG at block/blk-core.c:3347!
>     invalid opcode: 0000 [#1] PREEMPT SMP KASAN
>     CPU: 20 PID: 24369 Comm: mkfs.ext4 Not tainted 4.18.0-rc1-dbg+ #2
>     RIP: 0010:blk_end_request_all+0x68/0x70
>     Call Trace:
>      <IRQ>
>      dm_softirq_done+0x326/0x3d0 [dm_mod]
>      blk_done_softirq+0x19b/0x1e0
>      __do_softirq+0x128/0x60d
>      irq_exit+0x100/0x110
>      smp_call_function_single_interrupt+0x90/0x330
>      call_function_single_interrupt+0xf/0x20
>      </IRQ>
> 
> Fixes: f9d03f96b988 ("block: improve handling of the magic discard payload")
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Mike Snitzer <snitzer@redhat.com>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Johannes Thumshirn <jthumshirn@suse.de>
> Cc: <stable@vger.kernel.org>
> ---
>  block/blk-core.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 118dd17eb71f..f1e07ed1513c 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -3529,6 +3529,10 @@ static void __blk_rq_prep_clone(struct request *dst, struct request *src)
>  	dst->cpu = src->cpu;
>  	dst->__sector = blk_rq_pos(src);
>  	dst->__data_len = blk_rq_bytes(src);
> +	if (src->rq_flags & RQF_SPECIAL_PAYLOAD) {
> +		dst->rq_flags |= RQF_SPECIAL_PAYLOAD;
> +		dst->special_vec = src->special_vec;
> +	}
>  	dst->nr_phys_segments = src->nr_phys_segments;
>  	dst->ioprio = src->ioprio;
>  	dst->extra_len = src->extra_len;
> -- 
> 2.17.1

Reviewed-by: Ming Lei <ming.lei@redhat.com>

BTW, if possible, could you please make a block test to catch this issue?

thanks,
Ming

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

* Re: [PATCH] block: Fix cloning of requests with a special payload
  2018-06-27 23:41 ` Ming Lei
@ 2018-06-27 23:43   ` Bart Van Assche
  0 siblings, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2018-06-27 23:43 UTC (permalink / raw)
  To: Ming Lei
  Cc: Jens Axboe, linux-block@vger.kernel.org, Christoph Hellwig,
	Mike Snitzer, Hannes Reinecke, Johannes Thumshirn,
	stable@vger.kernel.org

On 06/27/18 16:42, Ming Lei wrote:
> Reviewed-by: Ming Lei <ming.lei@redhat.com>
> 
> BTW, if possible, could you please make a block test to catch this issue?

Hello Ming,

Thanks for the review.

I ran into this while testing the blktests port of the SRP tests scripts.

Bart.

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

* Re: [PATCH] block: Fix cloning of requests with a special payload
  2018-06-27 19:55 [PATCH] block: Fix cloning of requests with a special payload Bart Van Assche
  2018-06-27 23:41 ` Ming Lei
@ 2018-06-28 14:31 ` Christoph Hellwig
  2018-06-28 15:33 ` Mike Snitzer
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2018-06-28 14:31 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Mike Snitzer,
	Ming Lei, Hannes Reinecke, Johannes Thumshirn, stable

Thanks,

this looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: block: Fix cloning of requests with a special payload
  2018-06-27 19:55 [PATCH] block: Fix cloning of requests with a special payload Bart Van Assche
  2018-06-27 23:41 ` Ming Lei
  2018-06-28 14:31 ` Christoph Hellwig
@ 2018-06-28 15:33 ` Mike Snitzer
  2018-06-28 15:51 ` [PATCH] " Jens Axboe
  2018-06-28 16:17 ` Sagi Grimberg
  4 siblings, 0 replies; 7+ messages in thread
From: Mike Snitzer @ 2018-06-28 15:33 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Ming Lei,
	Hannes Reinecke, Johannes Thumshirn, stable

On Wed, Jun 27 2018 at  3:55pm -0400,
Bart Van Assche <bart.vanassche@wdc.com> wrote:

> This patch avoids that removing a path controlled by the dm-mpath driver
> while mkfs is running triggers the following kernel bug:
> 
>     kernel BUG at block/blk-core.c:3347!
>     invalid opcode: 0000 [#1] PREEMPT SMP KASAN
>     CPU: 20 PID: 24369 Comm: mkfs.ext4 Not tainted 4.18.0-rc1-dbg+ #2
>     RIP: 0010:blk_end_request_all+0x68/0x70
>     Call Trace:
>      <IRQ>
>      dm_softirq_done+0x326/0x3d0 [dm_mod]
>      blk_done_softirq+0x19b/0x1e0
>      __do_softirq+0x128/0x60d
>      irq_exit+0x100/0x110
>      smp_call_function_single_interrupt+0x90/0x330
>      call_function_single_interrupt+0xf/0x20
>      </IRQ>
> 
> Fixes: f9d03f96b988 ("block: improve handling of the magic discard payload")
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Mike Snitzer <snitzer@redhat.com>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Johannes Thumshirn <jthumshirn@suse.de>
> Cc: <stable@vger.kernel.org>

Acked-by: Mike Snitzer <snitzer@redhat.com>

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

* Re: [PATCH] block: Fix cloning of requests with a special payload
  2018-06-27 19:55 [PATCH] block: Fix cloning of requests with a special payload Bart Van Assche
                   ` (2 preceding siblings ...)
  2018-06-28 15:33 ` Mike Snitzer
@ 2018-06-28 15:51 ` Jens Axboe
  2018-06-28 16:17 ` Sagi Grimberg
  4 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2018-06-28 15:51 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: linux-block, Christoph Hellwig, Mike Snitzer, Ming Lei,
	Hannes Reinecke, Johannes Thumshirn, stable

On 6/27/18 1:55 PM, Bart Van Assche wrote:
> This patch avoids that removing a path controlled by the dm-mpath driver
> while mkfs is running triggers the following kernel bug:
> 
>     kernel BUG at block/blk-core.c:3347!
>     invalid opcode: 0000 [#1] PREEMPT SMP KASAN
>     CPU: 20 PID: 24369 Comm: mkfs.ext4 Not tainted 4.18.0-rc1-dbg+ #2
>     RIP: 0010:blk_end_request_all+0x68/0x70
>     Call Trace:
>      <IRQ>
>      dm_softirq_done+0x326/0x3d0 [dm_mod]
>      blk_done_softirq+0x19b/0x1e0
>      __do_softirq+0x128/0x60d
>      irq_exit+0x100/0x110
>      smp_call_function_single_interrupt+0x90/0x330
>      call_function_single_interrupt+0xf/0x20
>      </IRQ>

Thanks Bart, applied for 4.18.

-- 
Jens Axboe

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

* Re: [PATCH] block: Fix cloning of requests with a special payload
  2018-06-27 19:55 [PATCH] block: Fix cloning of requests with a special payload Bart Van Assche
                   ` (3 preceding siblings ...)
  2018-06-28 15:51 ` [PATCH] " Jens Axboe
@ 2018-06-28 16:17 ` Sagi Grimberg
  4 siblings, 0 replies; 7+ messages in thread
From: Sagi Grimberg @ 2018-06-28 16:17 UTC (permalink / raw)
  To: Bart Van Assche, Jens Axboe
  Cc: linux-block, Christoph Hellwig, Mike Snitzer, Ming Lei,
	Hannes Reinecke, Johannes Thumshirn, stable

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

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

end of thread, other threads:[~2018-06-28 16:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-27 19:55 [PATCH] block: Fix cloning of requests with a special payload Bart Van Assche
2018-06-27 23:41 ` Ming Lei
2018-06-27 23:43   ` Bart Van Assche
2018-06-28 14:31 ` Christoph Hellwig
2018-06-28 15:33 ` Mike Snitzer
2018-06-28 15:51 ` [PATCH] " Jens Axboe
2018-06-28 16:17 ` Sagi Grimberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).