Skip to content

Commit e63a573

Browse files
Ming Leiaxboe
authored andcommitted
blk-cgroup: bypass blkcg_deactivate_policy after destroying
blkcg_deactivate_policy() can be called after blkg_destroy_all() returns, and it isn't necessary since blkg_destroy_all has covered policy deactivation. Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20231117023527.3188627-4-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 35a99d6 commit e63a573

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

block/blk-cgroup.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ static void blkg_destroy_all(struct gendisk *disk)
577577
struct request_queue *q = disk->queue;
578578
struct blkcg_gq *blkg, *n;
579579
int count = BLKG_DESTROY_BATCH_SIZE;
580+
int i;
580581

581582
restart:
582583
spin_lock_irq(&q->queue_lock);
@@ -602,6 +603,18 @@ static void blkg_destroy_all(struct gendisk *disk)
602603
}
603604
}
604605

606+
/*
607+
* Mark policy deactivated since policy offline has been done, and
608+
* the free is scheduled, so future blkcg_deactivate_policy() can
609+
* be bypassed
610+
*/
611+
for (i = 0; i < BLKCG_MAX_POLS; i++) {
612+
struct blkcg_policy *pol = blkcg_policy[i];
613+
614+
if (pol)
615+
__clear_bit(pol->plid, q->blkcg_pols);
616+
}
617+
605618
q->root_blkg = NULL;
606619
spin_unlock_irq(&q->queue_lock);
607620
}

0 commit comments

Comments
 (0)