blk-mq: bitmap tag: fix races in bt_get() function
authorAlexander Gordeev <agordeev@redhat.com>
Tue, 17 Jun 2014 20:37:23 +0000 (22:37 +0200)
committerJens Axboe <axboe@fb.com>
Mon, 30 Mar 2015 18:54:54 +0000 (12:54 -0600)
commit38b1e8430623353451a8464d3edfe220ff0fe063
tree3458522c82cf705dd958202c14e295f21fa2f705
parent2348aae23ad7c65f673f3f1d359770e2b1d3d166
blk-mq: bitmap tag: fix races in bt_get() function

This update fixes few issues in bt_get() function:

- list_empty(&wait.task_list) check is not protected;

- was_empty check is always true which results in *every* thread
  entering the loop resets bt_wait_state::wait_cnt counter rather
  than every bt->wake_cnt'th thread;

- 'bt_wait_state::wait_cnt' counter update is redundant, since
  it also gets reset in bt_clear_tag() function;

Cc: Christoph Hellwig <hch@infradead.org>
Cc: Ming Lei <tom.leiming@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq-tag.c