blk-mq: bitmap tag: fix races in bt_get() function
authorAlexander Gordeev <[email protected]>
Tue, 17 Jun 2014 20:37:23 +0000 (22:37 +0200)
committerJens Axboe <[email protected]>
Wed, 18 Jun 2014 05:13:08 +0000 (22:13 -0700)
commit86fb5c56cfa26de5e91c9a50e2767a695dff366e
treeda76443281fb15c54d56400b25ff9279e0b9e33e
parent2971c35f35886b87af54675313a2afef937c1b0c
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 <[email protected]>
Cc: Ming Lei <[email protected]>
Cc: Jens Axboe <[email protected]>
Signed-off-by: Alexander Gordeev <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
block/blk-mq-tag.c