Skip to content

Commit

Permalink
bfq: Track whether bfq_group is still online
Browse files Browse the repository at this point in the history
commit 09f8718 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>
  • Loading branch information
jankara authored and gregkh committed Jun 9, 2022
1 parent 7be1cbf commit 1fcb17c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion block/bfq-cgroup.c
Expand Up @@ -557,6 +557,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;
}

Expand Down Expand Up @@ -603,7 +604,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;

Expand Down Expand Up @@ -971,6 +971,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);
/*
Expand Down
2 changes: 2 additions & 0 deletions block/bfq-iosched.h
Expand Up @@ -930,6 +930,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;
Expand Down

0 comments on commit 1fcb17c

Please sign in to comment.