Re: WARNING in block layer triggered in 3.17-rc3

From: Alan Stern
Date: Mon Sep 08 2014 - 10:51:48 EST


On Sun, 7 Sep 2014, Shirish Pargaonkar wrote:

> I think the problem is, when a gendisk is detached, its request queue
> is not put in bypass mode
> cause when it is re-attached, code tries to put it out of bypass mode,
> hence the warning.
>
> So either of these should work, I have not tested it, just coded it up.

I'm pretty sure that both of your solutions are wrong.

Jens and James, it appears the problem is in blk_register_queue(). The
code does this:

/*
* Initialization must be complete by now. Finish the initial
* bypass from queue allocation.
*/
queue_flag_set_unlocked(QUEUE_FLAG_INIT_DONE, q);
blk_queue_bypass_end(q);

This doesn't work well if the queue is unregistered later and then
registered again -- which is what happens when the sd driver is unbound
from a device and then bound again. It looks like the code should be:

if (!queue_flag_test_and_set(QUEUE_FLAG_INIT_DONE, q))
blk_queue_bypass_end(q);

Do you agree? If so, I'll send in patch.

Alan Stern

--
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/