blk-mq: Avoid that __bt_get_word() wraps multiple times
authorBart Van Assche <bvanassche@acm.org>
Tue, 9 Dec 2014 15:58:11 +0000 (16:58 +0100)
committerJens Axboe <axboe@fb.com>
Mon, 30 Mar 2015 18:54:56 +0000 (12:54 -0600)
commit7535a7995709a97ce74f449eeecdad1a738d63ea
treeb6134932d9b95b0f502ff4eba6fd76203e78c615
parentfe0c52419e3e7333ad6d37bdf0cea15f964bc4da
blk-mq: Avoid that __bt_get_word() wraps multiple times

If __bt_get_word() is called with last_tag != 0, if the first
find_next_zero_bit() fails, if after wrap-around the
test_and_set_bit() call fails and find_next_zero_bit() succeeds,
if the next test_and_set_bit() call fails and subsequently
find_next_zero_bit() does not find a zero bit, then another
wrap-around will occur. Avoid this by introducing an additional
local variable.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Robert Elliott <elliott@hp.com>
Cc: Ming Lei <ming.lei@canonical.com>
Cc: Alexander Gordeev <agordeev@redhat.com>
Cc: <stable@vger.kernel.org> # v3.13+
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq-tag.c