On Tue, 9 Sep 2014, Tejun Heo wrote: > Hello, > > On Mon, Sep 08, 2014 at 01:42:44PM -0400, Alan Stern wrote: > > > This looks like a nasty hack. In theory the QUEUE_FLAG_INIT_DONE should > > > be unset on blk_unregister_queue() to match the teardown; it's only > > > accident it isn't. del_gendisk() in sd_remove() is supposed to tear a > > > lot of queue stuff down. > > > > It's not clear what the operative assumptions are. The comment in > > blk_register_queue() implies that bypass is active only because it was > > set up that way when the queue was created. The fact that > > blk_unregister_queue() doesn't call blk_queue_bypass_start() seems to > > support this view -- although it could also be a simple oversight. > > > > Hopefully Tejun can clear this iup. > > Maintaining the initial bypass till queue registration is an > optimization because shutting down a fully functional queue is a > costly operation and there are drivers which set and destroy queues > repeatedly while probing, so, yeah, it's really a special case for > when the queue is being registered for the first time. > > > > Your hack seems to indicate that this doesn't work on the add->del->add > > > transtion of a gendisk. > > > > Indeed, it does not work. > > As such, the change you suggested makes perfect sense to me. Why > wouldn't it work? Sorry, the meaning wasn't clear. I meant that the existing code doesn't work. The patch seems to work okay (except that I can't use queue_flag_test_and_set because the queue isn't locked at that point). I'll submit the patch shortly. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html