* [PATCH block#for-2.6.31] block: fix an oops on BLKPREP_KILL
@ 2009-05-29 22:18 James Bottomley
2009-05-30 4:41 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: James Bottomley @ 2009-05-29 22:18 UTC (permalink / raw)
To: Tejun Heo, Jens Axboe; +Cc: linux-scsi, linux-ide
Doing a bit of torture testing, I ran across a BUG in the block
subsystem (at blk-core.c:2048): the test for if the request is queued.
It turns out the trigger was a BLKPREP_KILL coming out of the SCSI prep
function. Currently for BLKPREP_KILL requests, we send them straight
into __blk_end_request_all() with an error, but they've never been
dequeued, so they trip the bug. Fix this by starting requests before
killing them.
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
diff --git a/block/blk-core.c b/block/blk-core.c
index 8b3b74e..9a0568c 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1789,6 +1789,7 @@ struct request *blk_peek_request(struct request_queue *q)
break;
} else if (ret == BLKPREP_KILL) {
rq->cmd_flags |= REQ_QUIET;
+ blk_start_request(rq);
__blk_end_request_all(rq, -EIO);
} else {
printk(KERN_ERR "%s: bad return=%d\n", __func__, ret);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH block#for-2.6.31] block: fix an oops on BLKPREP_KILL
2009-05-29 22:18 [PATCH block#for-2.6.31] block: fix an oops on BLKPREP_KILL James Bottomley
@ 2009-05-30 4:41 ` Jens Axboe
2009-05-30 14:23 ` James Bottomley
0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2009-05-30 4:41 UTC (permalink / raw)
To: James Bottomley; +Cc: Tejun Heo, linux-scsi, linux-ide
On Fri, May 29 2009, James Bottomley wrote:
> Doing a bit of torture testing, I ran across a BUG in the block
> subsystem (at blk-core.c:2048): the test for if the request is queued.
>
> It turns out the trigger was a BLKPREP_KILL coming out of the SCSI prep
> function. Currently for BLKPREP_KILL requests, we send them straight
> into __blk_end_request_all() with an error, but they've never been
> dequeued, so they trip the bug. Fix this by starting requests before
> killing them.
>
> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
>
> ---
>
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 8b3b74e..9a0568c 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -1789,6 +1789,7 @@ struct request *blk_peek_request(struct request_queue *q)
> break;
> } else if (ret == BLKPREP_KILL) {
> rq->cmd_flags |= REQ_QUIET;
> + blk_start_request(rq);
> __blk_end_request_all(rq, -EIO);
> } else {
> printk(KERN_ERR "%s: bad return=%d\n", __func__, ret);
Given how illogical that now looks, I think it could do with a comment.
I'll add that while applying.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH block#for-2.6.31] block: fix an oops on BLKPREP_KILL
2009-05-30 4:41 ` Jens Axboe
@ 2009-05-30 14:23 ` James Bottomley
2009-05-31 6:11 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: James Bottomley @ 2009-05-30 14:23 UTC (permalink / raw)
To: Jens Axboe; +Cc: Tejun Heo, linux-scsi, linux-ide
On Sat, 2009-05-30 at 06:41 +0200, Jens Axboe wrote:
> On Fri, May 29 2009, James Bottomley wrote:
> > Doing a bit of torture testing, I ran across a BUG in the block
> > subsystem (at blk-core.c:2048): the test for if the request is queued.
> >
> > It turns out the trigger was a BLKPREP_KILL coming out of the SCSI prep
> > function. Currently for BLKPREP_KILL requests, we send them straight
> > into __blk_end_request_all() with an error, but they've never been
> > dequeued, so they trip the bug. Fix this by starting requests before
> > killing them.
> >
> > Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
> >
> > ---
> >
> > diff --git a/block/blk-core.c b/block/blk-core.c
> > index 8b3b74e..9a0568c 100644
> > --- a/block/blk-core.c
> > +++ b/block/blk-core.c
> > @@ -1789,6 +1789,7 @@ struct request *blk_peek_request(struct request_queue *q)
> > break;
> > } else if (ret == BLKPREP_KILL) {
> > rq->cmd_flags |= REQ_QUIET;
> > + blk_start_request(rq);
> > __blk_end_request_all(rq, -EIO);
> > } else {
> > printk(KERN_ERR "%s: bad return=%d\n", __func__, ret);
>
> Given how illogical that now looks, I think it could do with a comment.
> I'll add that while applying.
Um, if it looks illogical, then so is the new everything has to be
dequeued before completion requirement ... I agree a comment reminding
people why it has to work this way doesn't hurt, but if it looks
illogical then there might be something wrong with the rules requiring
this to happen ...
James
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH block#for-2.6.31] block: fix an oops on BLKPREP_KILL
2009-05-30 14:23 ` James Bottomley
@ 2009-05-31 6:11 ` Jens Axboe
0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2009-05-31 6:11 UTC (permalink / raw)
To: James Bottomley; +Cc: Tejun Heo, linux-scsi, linux-ide
On Sat, May 30 2009, James Bottomley wrote:
> On Sat, 2009-05-30 at 06:41 +0200, Jens Axboe wrote:
> > On Fri, May 29 2009, James Bottomley wrote:
> > > Doing a bit of torture testing, I ran across a BUG in the block
> > > subsystem (at blk-core.c:2048): the test for if the request is queued.
> > >
> > > It turns out the trigger was a BLKPREP_KILL coming out of the SCSI prep
> > > function. Currently for BLKPREP_KILL requests, we send them straight
> > > into __blk_end_request_all() with an error, but they've never been
> > > dequeued, so they trip the bug. Fix this by starting requests before
> > > killing them.
> > >
> > > Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
> > >
> > > ---
> > >
> > > diff --git a/block/blk-core.c b/block/blk-core.c
> > > index 8b3b74e..9a0568c 100644
> > > --- a/block/blk-core.c
> > > +++ b/block/blk-core.c
> > > @@ -1789,6 +1789,7 @@ struct request *blk_peek_request(struct request_queue *q)
> > > break;
> > > } else if (ret == BLKPREP_KILL) {
> > > rq->cmd_flags |= REQ_QUIET;
> > > + blk_start_request(rq);
> > > __blk_end_request_all(rq, -EIO);
> > > } else {
> > > printk(KERN_ERR "%s: bad return=%d\n", __func__, ret);
> >
> > Given how illogical that now looks, I think it could do with a comment.
> > I'll add that while applying.
>
> Um, if it looks illogical, then so is the new everything has to be
> dequeued before completion requirement ... I agree a comment reminding
> people why it has to work this way doesn't hurt, but if it looks
> illogical then there might be something wrong with the rules requiring
> this to happen ...
It's not a bad idea to be a little extra paranoid with such an API
change, we can always relax this restriction later.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-05-31 6:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-29 22:18 [PATCH block#for-2.6.31] block: fix an oops on BLKPREP_KILL James Bottomley
2009-05-30 4:41 ` Jens Axboe
2009-05-30 14:23 ` James Bottomley
2009-05-31 6:11 ` 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).