cfq: reset async queues references after put

Fix putting one queue reference multiple times that causes kernel panics
in particular in the following cases:
 * changing I/O sheduler on the fly
 * booting the node with usb-kvm installed
 * insert usb flash, write to it, remove usb flash

http://bugzilla.openvz.org/show_bug.cgi?id=1595
https://bugzilla.sw.ru/show_bug.cgi?id=483488

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
---
 block/cfq-iosched.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index f03062d..a9aa589 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2646,10 +2646,12 @@ void __cfq_put_async_queues(struct cfq_bc_data *cfq_bc)
 			cfq_put_queue(cfq_bc->async_cfqq[0][i]);
 		if (cfq_bc->async_cfqq[1][i])
 			cfq_put_queue(cfq_bc->async_cfqq[1][i]);
+		cfq_bc->async_cfqq[0][i] = cfq_bc->async_cfqq[1][i] = NULL;
 	}
 
 	if (cfq_bc->async_idle_cfqq)
 		cfq_put_queue(cfq_bc->async_idle_cfqq);
+	cfq_bc->async_idle_cfqq = NULL;
 }
 
 #ifdef CONFIG_UBC_IO_PRIO


