[PATCH] blk: start bypass mode in blk_unregister_queue

From: Aaron Lu
Date: Thu Apr 04 2013 - 10:00:40 EST


In blk_register_queue, we will end bypass mode for the queue; but in
blk_unregister_queue, we didn't start bypass mode for it. This would
cause the WARN_ON_ONCE(q->bypass_depth < 0) to trigger if the queue gets
registered, unregistered and then again registered, e.g. unload scsi
cdrom module driver sr_mod and then reload it will trigger such a
warning.

Signed-off-by: Aaron Lu <aaron.lu@xxxxxxxxx>
---
block/blk-sysfs.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 6206a93..bd322a1 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -615,4 +615,6 @@ void blk_unregister_queue(struct gendisk *disk)
kobject_del(&q->kobj);
blk_trace_remove_sysfs(disk_to_dev(disk));
kobject_put(&disk_to_dev(disk)->kobj);
+
+ blk_queue_bypass_start(q);
}
--
1.8.1.5

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