linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] null_blk: fix spurious IO errors after failed past-wp access
@ 2020-02-12 20:23 Alexey Dobriyan
  2020-02-15  3:20 ` Chaitanya Kulkarni
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexey Dobriyan @ 2020-02-12 20:23 UTC (permalink / raw)
  To: axboe; +Cc: linux-block

Steps to reproduce:

	BLKRESETZONE zone 0

	// force EIO
	pwrite(fd, buf, 4096, 4096);

	[issue more IO including zone ioctls]

It will start failing randomly including IO to unrelated zones because of
->error "reuse". Trigger can be partition detection as well if test is not
run immediately which is even more entertaining.

The fix is of course to clear ->error where necessary.

Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
---

 drivers/block/null_blk_main.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -605,6 +605,7 @@ static struct nullb_cmd *__alloc_cmd(struct nullb_queue *nq)
 	if (tag != -1U) {
 		cmd = &nq->cmds[tag];
 		cmd->tag = tag;
+		cmd->error = BLK_STS_OK;
 		cmd->nq = nq;
 		if (nq->dev->irqmode == NULL_IRQ_TIMER) {
 			hrtimer_init(&cmd->timer, CLOCK_MONOTONIC,
@@ -1385,6 +1386,7 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ctx *hctx,
 		cmd->timer.function = null_cmd_timer_expired;
 	}
 	cmd->rq = bd->rq;
+	cmd->error = BLK_STS_OK;
 	cmd->nq = nq;
 
 	blk_mq_start_request(bd->rq);

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

* Re: [PATCH] null_blk: fix spurious IO errors after failed past-wp access
  2020-02-12 20:23 [PATCH] null_blk: fix spurious IO errors after failed past-wp access Alexey Dobriyan
@ 2020-02-15  3:20 ` Chaitanya Kulkarni
  2020-02-19 16:35 ` Christoph Hellwig
  2020-03-12 15:10 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2020-02-15  3:20 UTC (permalink / raw)
  To: Alexey Dobriyan, axboe; +Cc: linux-block

Alexey, thanks for the patch however the description is
not simple to understand.

I just sent a patch with a description and the test result.

On 02/12/2020 12:23 PM, Alexey Dobriyan wrote:
> Steps to reproduce:
>
> 	BLKRESETZONE zone 0
>
> 	// force EIO
> 	pwrite(fd, buf, 4096, 4096);
>
> 	[issue more IO including zone ioctls]
>
> It will start failing randomly including IO to unrelated zones because of
> ->error "reuse". Trigger can be partition detection as well if test is not
> run immediately which is even more entertaining.
>
> The fix is of course to clear ->error where necessary.
>
> Signed-off-by: Alexey Dobriyan (SK hynix)<adobriyan@gmail.com>
> ---
>
>   drivers/block/null_blk_main.c |    2 ++


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

* Re: [PATCH] null_blk: fix spurious IO errors after failed past-wp access
  2020-02-12 20:23 [PATCH] null_blk: fix spurious IO errors after failed past-wp access Alexey Dobriyan
  2020-02-15  3:20 ` Chaitanya Kulkarni
@ 2020-02-19 16:35 ` Christoph Hellwig
  2020-03-12 15:10 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2020-02-19 16:35 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: axboe, linux-block

On Wed, Feb 12, 2020 at 11:23:20PM +0300, Alexey Dobriyan wrote:
> Steps to reproduce:
> 
> 	BLKRESETZONE zone 0
> 
> 	// force EIO
> 	pwrite(fd, buf, 4096, 4096);
> 
> 	[issue more IO including zone ioctls]
> 
> It will start failing randomly including IO to unrelated zones because of
> ->error "reuse". Trigger can be partition detection as well if test is not
> run immediately which is even more entertaining.
> 
> The fix is of course to clear ->error where necessary.
> 
> Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
> ---
> 
>  drivers/block/null_blk_main.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- a/drivers/block/null_blk_main.c
> +++ b/drivers/block/null_blk_main.c
> @@ -605,6 +605,7 @@ static struct nullb_cmd *__alloc_cmd(struct nullb_queue *nq)
>  	if (tag != -1U) {
>  		cmd = &nq->cmds[tag];
>  		cmd->tag = tag;
> +		cmd->error = BLK_STS_OK;

I'd place this line in null_queue_bio to match the blk-mq patch
more closely.

Otherwise this looks fine:

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

Can you add your testcase to blktests?

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

* Re: [PATCH] null_blk: fix spurious IO errors after failed past-wp access
  2020-02-12 20:23 [PATCH] null_blk: fix spurious IO errors after failed past-wp access Alexey Dobriyan
  2020-02-15  3:20 ` Chaitanya Kulkarni
  2020-02-19 16:35 ` Christoph Hellwig
@ 2020-03-12 15:10 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2020-03-12 15:10 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: linux-block

On 2/12/20 1:23 PM, Alexey Dobriyan wrote:
> Steps to reproduce:
> 
> 	BLKRESETZONE zone 0
> 
> 	// force EIO
> 	pwrite(fd, buf, 4096, 4096);
> 
> 	[issue more IO including zone ioctls]
> 
> It will start failing randomly including IO to unrelated zones because of
> ->error "reuse". Trigger can be partition detection as well if test is not
> run immediately which is even more entertaining.
> 
> The fix is of course to clear ->error where necessary.

Applied, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2020-03-12 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-12 20:23 [PATCH] null_blk: fix spurious IO errors after failed past-wp access Alexey Dobriyan
2020-02-15  3:20 ` Chaitanya Kulkarni
2020-02-19 16:35 ` Christoph Hellwig
2020-03-12 15:10 ` Jens Axboe

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).