Commit d9132b72 authored by Ming Lei's avatar Ming Lei Committed by Chen Ridong
Browse files

blk-cgroup: bypass blkcg_deactivate_policy after destroying

mainline inclusion
from mainline-v6.7-rc3
commit e63a57303599b17290cd8bc48e6f20b24289a8bc
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I91BXW



----------------------------------------------------------------------

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: default avatarMing Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20231117023527.3188627-4-ming.lei@redhat.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarChen Ridong <chenridong@huawei.com>
parent 61718867
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -577,6 +577,7 @@ static void blkg_destroy_all(struct gendisk *disk)
	struct request_queue *q = disk->queue;
	struct blkcg_gq *blkg, *n;
	int count = BLKG_DESTROY_BATCH_SIZE;
	int i;

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

	/*
	 * Mark policy deactivated since policy offline has been done, and
	 * the free is scheduled, so future blkcg_deactivate_policy() can
	 * be bypassed
	 */
	for (i = 0; i < BLKCG_MAX_POLS; i++) {
		struct blkcg_policy *pol = blkcg_policy[i];

		if (pol)
			__clear_bit(pol->plid, q->blkcg_pols);
	}

	q->root_blkg = NULL;
	spin_unlock_irq(&q->queue_lock);
}