Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block: Remove elevator_lock usage from blkg_conf frozen operations

Remove the acquisition and release of q->elevator_lock in the
blkg_conf_open_bdev_frozen() and blkg_conf_exit_frozen() functions. The
elevator lock is no longer needed in these code paths since commit
78c271344b6f ("block: move wbt_enable_default() out of queue freezing
from sched ->exit()") which introduces `disk->rqos_state_mutex` for
protecting wbt state change, and not necessary to abuse elevator_lock
for this purpose.

This change helps to solve the lockdep warning reported from Yu Kuai[1].

Pass blktests/throtl with lockdep enabled.

Links: https://lore.kernel.org/linux-block/e5e7ac3f-2063-473a-aafb-4d8d43e5576e@yukuai.org.cn/ [1]
Fixes: commit 78c271344b6f ("block: move wbt_enable_default() out of queue freezing from sched ->exit()")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Ming Lei and committed by
Jens Axboe
08823e89 dc96cefe

+4 -9
+4 -9
block/blk-cgroup.c
··· 812 812 } 813 813 /* 814 814 * Similar to blkg_conf_open_bdev, but additionally freezes the queue, 815 - * acquires q->elevator_lock, and ensures the correct locking order 816 - * between q->elevator_lock and q->rq_qos_mutex. 815 + * ensures the correct locking order between freeze queue and q->rq_qos_mutex. 817 816 * 818 817 * This function returns negative error on failure. On success it returns 819 818 * memflags which must be saved and later passed to blkg_conf_exit_frozen ··· 833 834 * At this point, we haven’t started protecting anything related to QoS, 834 835 * so we release q->rq_qos_mutex here, which was first acquired in blkg_ 835 836 * conf_open_bdev. Later, we re-acquire q->rq_qos_mutex after freezing 836 - * the queue and acquiring q->elevator_lock to maintain the correct 837 - * locking order. 837 + * the queue to maintain the correct locking order. 838 838 */ 839 839 mutex_unlock(&ctx->bdev->bd_queue->rq_qos_mutex); 840 840 841 841 memflags = blk_mq_freeze_queue(ctx->bdev->bd_queue); 842 - mutex_lock(&ctx->bdev->bd_queue->elevator_lock); 843 842 mutex_lock(&ctx->bdev->bd_queue->rq_qos_mutex); 844 843 845 844 return memflags; ··· 992 995 EXPORT_SYMBOL_GPL(blkg_conf_exit); 993 996 994 997 /* 995 - * Similar to blkg_conf_exit, but also unfreezes the queue and releases 996 - * q->elevator_lock. Should be used when blkg_conf_open_bdev_frozen 997 - * is used to open the bdev. 998 + * Similar to blkg_conf_exit, but also unfreezes the queue. Should be used 999 + * when blkg_conf_open_bdev_frozen is used to open the bdev. 998 1000 */ 999 1001 void blkg_conf_exit_frozen(struct blkg_conf_ctx *ctx, unsigned long memflags) 1000 1002 { ··· 1001 1005 struct request_queue *q = ctx->bdev->bd_queue; 1002 1006 1003 1007 blkg_conf_exit(ctx); 1004 - mutex_unlock(&q->elevator_lock); 1005 1008 blk_mq_unfreeze_queue(q, memflags); 1006 1009 } 1007 1010 }