Re: Crash in elevator_dispatch_fn() (e.g. deadline_dispatch()) whenchanging elevators.

From: Frank Mayhar
Date: Thu Jan 23 2014 - 16:14:49 EST


On Thu, 2014-01-23 at 13:56 -0500, Tejun Heo wrote:
> On Thu, Jan 23, 2014 at 10:38:33AM -0800, Frank Mayhar wrote:
> > On Wed, 2014-01-22 at 07:46 -0800, Frank Mayhar wrote:
> > > On Tue, 2014-01-21 at 07:58 -0800, Frank Mayhar wrote:
> > > > Replacing? Or adding to? Is BYPASS always set when DYING is set? (My
> > > > guess is not but I haven't done an exhaustive analysis.) So the
> > > > relevant code snippet in __elv_next_request() would be:
> > > > if (unlikely(blk_queue_dying(q)) ||
> > > > unlikely(blk_queue_bypass(q)) ||
> > > > !q->elevator->type->ops.elevator_dispatch_fn(q, 0))
> > > > return NULL;
> > >
> > > FYI, I've made this change and tested it. I can't say for certain that
> > > it fixes the crash (since it's one of those races that's difficult to
> > > reproduce), but it does seem to pass all the tests I've thrown at it so
> > > far.
> >
> > Um, does anyone care about this? Tejun? Jens? Anyone?
> >
> > This is a real crash; it would be nice if someone would weigh in.
>
> Yeah, we're gonna fix this and I *think* replacing dying with bypass
> is the right thing to do as a queue is always bypassing when killed.
> It's probably just that we're in the earlier part of the merge window
> and I have some other things on my plate. Will post a patch in a
> couple days.

Thanks!

For the record, I've seriously beaten on the change above (despite it
maybe being redundant, it seems to do the right thing) and have seen no
problems so far. I've changed it to _just_ check bypass and will beat
on that now. If you're correct that a dying queue always has bypass set
then I anticipate no problems.
--
Frank Mayhar
310-460-4042

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/