aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-mq-tag.c
diff options
context:
space:
mode:
authorMing Lei <tom.leiming@gmail.com>2014-05-10 13:01:48 -0400
committerJens Axboe <axboe@fb.com>2014-05-10 17:41:42 -0400
commit0289b2e110b7824b2f76d194ad6f8f0844e270ad (patch)
treeeac254d7cd5b82bda9cfb4cd8b489c6173b40659 /block/blk-mq-tag.c
parent59d13bf5f57ded658c872fa22276f75ab8f12841 (diff)
blk-mq: bitmap tag: use clear_bit_unlock in bt_clear_tag()
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>
Diffstat (limited to 'block/blk-mq-tag.c')
-rw-r--r--block/blk-mq-tag.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index 6c78c08865e3..a81b138e89fe 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -236,7 +236,11 @@ static void bt_clear_tag(struct blk_mq_bitmap_tags *bt, unsigned int tag)
236 const int index = TAG_TO_INDEX(bt, tag); 236 const int index = TAG_TO_INDEX(bt, tag);
237 struct bt_wait_state *bs; 237 struct bt_wait_state *bs;
238 238
239 clear_bit(TAG_TO_BIT(bt, tag), &bt->map[index].word); 239 /*
240 * The unlock memory barrier need to order access to req in free
241 * path and clearing tag bit
242 */
243 clear_bit_unlock(TAG_TO_BIT(bt, tag), &bt->map[index].word);
240 244
241 bs = bt_wake_ptr(bt); 245 bs = bt_wake_ptr(bt);
242 if (bs && atomic_dec_and_test(&bs->wait_cnt)) { 246 if (bs && atomic_dec_and_test(&bs->wait_cnt)) {