Skip to content

Commit b7435db

Browse files
KAGA-KOKOaxboe
authored andcommitted
blk-mq: Add locking annotations to hctx_lock() and hctx_unlock()
This patch avoids that sparse reports the following: block/blk-mq.c:637:33: warning: context imbalance in 'hctx_unlock' - unexpected unlock block/blk-mq.c:642:9: warning: context imbalance in 'hctx_lock' - wrong count at exit Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Cc: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 0478fe6 commit b7435db

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

block/blk-mq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ static void __blk_mq_complete_request(struct request *rq)
559559
}
560560

561561
static void hctx_unlock(struct blk_mq_hw_ctx *hctx, int srcu_idx)
562+
__releases(hctx->srcu)
562563
{
563564
if (!(hctx->flags & BLK_MQ_F_BLOCKING))
564565
rcu_read_unlock();
@@ -567,6 +568,7 @@ static void hctx_unlock(struct blk_mq_hw_ctx *hctx, int srcu_idx)
567568
}
568569

569570
static void hctx_lock(struct blk_mq_hw_ctx *hctx, int *srcu_idx)
571+
__acquires(hctx->srcu)
570572
{
571573
if (!(hctx->flags & BLK_MQ_F_BLOCKING)) {
572574
/* shut up gcc false positive */

0 commit comments

Comments
 (0)