Skip to content

Commit 5aeac7c

Browse files
htejunaxboe
authored andcommitted
blk-iocost: ioc_pd_free() shouldn't assume irq disabled
ioc_pd_free() grabs irq-safe ioc->lock without ensuring that irq is disabled when it can be called with irq disabled or enabled. This has a small chance of causing A-A deadlocks and triggers lockdep splats. Use irqsave operations instead. Signed-off-by: Tejun Heo <tj@kernel.org> Fixes: 7caa471 ("blkcg: implement blk-iocost") Cc: stable@vger.kernel.org # v5.4+ Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 08fc1ab commit 5aeac7c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

block/blk-iocost.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,14 +2092,15 @@ static void ioc_pd_free(struct blkg_policy_data *pd)
20922092
{
20932093
struct ioc_gq *iocg = pd_to_iocg(pd);
20942094
struct ioc *ioc = iocg->ioc;
2095+
unsigned long flags;
20952096

20962097
if (ioc) {
2097-
spin_lock(&ioc->lock);
2098+
spin_lock_irqsave(&ioc->lock, flags);
20982099
if (!list_empty(&iocg->active_list)) {
20992100
propagate_active_weight(iocg, 0, 0);
21002101
list_del_init(&iocg->active_list);
21012102
}
2102-
spin_unlock(&ioc->lock);
2103+
spin_unlock_irqrestore(&ioc->lock, flags);
21032104

21042105
hrtimer_cancel(&iocg->waitq_timer);
21052106
hrtimer_cancel(&iocg->delay_timer);

0 commit comments

Comments
 (0)