Skip to content

Commit

Permalink
blk-mq: bitmap tag: use clear_bit_unlock in bt_clear_tag()
Browse files Browse the repository at this point in the history
The unlock memory barrier need to order access to req in free
path and clearing tag bit, otherwise either request free path
may see a allocated request, or initialized request in allocate
path might be modified by the ongoing free path.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Ming Lei authored and Jens Axboe committed May 10, 2014
1 parent 59d13bf commit 0289b2e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion block/blk-mq-tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ static void bt_clear_tag(struct blk_mq_bitmap_tags *bt, unsigned int tag)
const int index = TAG_TO_INDEX(bt, tag);
struct bt_wait_state *bs;

clear_bit(TAG_TO_BIT(bt, tag), &bt->map[index].word);
/*
* The unlock memory barrier need to order access to req in free
* path and clearing tag bit
*/
clear_bit_unlock(TAG_TO_BIT(bt, tag), &bt->map[index].word);

bs = bt_wake_ptr(bt);
if (bs && atomic_dec_and_test(&bs->wait_cnt)) {
Expand Down

0 comments on commit 0289b2e

Please sign in to comment.