block: avoid unconditionally freeing previously allocated request_queue
authorMike Snitzer <snitzer@redhat.com>
Thu, 3 Jun 2010 17:34:52 +0000 (11:34 -0600)
committerJens Axboe <jaxboe@fusionio.com>
Fri, 4 Jun 2010 11:47:06 +0000 (13:47 +0200)
On blk_init_allocated_queue_node failure, only free the request_queue if
it is wasn't previously allocated outside the block layer
(e.g. blk_init_queue_node was blk_init_allocated_queue_node caller).

This addresses an interface bug introduced by the following commit:
01effb0 block: allow initialization of previously allocated
request_queue

Otherwise the request_queue may be free'd out from underneath a caller
that is managing the request_queue directly (e.g. caller uses
blk_alloc_queue + blk_init_allocated_queue_node).

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
block/blk-core.c

Simple merge