]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
bfq: Track whether bfq_group is still online
authorJan Kara <jack@suse.cz>
Fri, 1 Apr 2022 10:27:48 +0000 (12:27 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 10 Aug 2022 07:25:08 +0000 (09:25 +0200)
BugLink: https://bugs.launchpad.net/bugs/1981864
commit 09f871868080c33992cd6a9b72a5ca49582578fa upstream.

Track whether bfq_group is still online. We cannot rely on
blkcg_gq->online because that gets cleared only after all policies are
offlined and we need something that gets updated already under
bfqd->lock when we are cleaning up our bfq_group to be able to guarantee
that when we see online bfq_group, it will stay online while we are
holding bfqd->lock lock.

CC: stable@vger.kernel.org
Tested-by: "yukuai (C)" <yukuai3@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220401102752.8599-7-jack@suse.cz
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
block/bfq-cgroup.c
block/bfq-iosched.h

index 7f7243aa6677be3e1d0b000422b9249a1e6a100e..ff6379725c140cbdcca58e37c815bf040f0ba176 100644 (file)
@@ -555,6 +555,7 @@ static void bfq_pd_init(struct blkg_policy_data *pd)
                                   */
        bfqg->bfqd = bfqd;
        bfqg->active_entities = 0;
+       bfqg->online = true;
        bfqg->rq_pos_tree = RB_ROOT;
 }
 
@@ -601,7 +602,6 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd,
        struct bfq_entity *entity;
 
        bfqg = bfq_lookup_bfqg(bfqd, blkcg);
-
        if (unlikely(!bfqg))
                return NULL;
 
@@ -969,6 +969,7 @@ static void bfq_pd_offline(struct blkg_policy_data *pd)
 
 put_async_queues:
        bfq_put_async_queues(bfqd, bfqg);
+       bfqg->online = false;
 
        spin_unlock_irqrestore(&bfqd->lock, flags);
        /*
index 79d003cca90e7417c93b8972b67f79f8b91c41b7..e3e8e89fcb008681f494738b40d1267d2fbd251e 100644 (file)
@@ -926,6 +926,8 @@ struct bfq_group {
 
        /* reference counter (see comments in bfq_bic_update_cgroup) */
        int ref;
+       /* Is bfq_group still online? */
+       bool online;
 
        struct bfq_entity entity;
        struct bfq_sched_data sched_data;