]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
cfq: clear queue pointers from cfqg after unpinning them in cfq_pd_offline
authorMaciej S. Szmigiero <mail@maciej.szmigiero.name>
Wed, 10 Oct 2018 21:16:50 +0000 (23:16 +0200)
committerJens Axboe <axboe@kernel.dk>
Thu, 11 Oct 2018 17:46:19 +0000 (11:46 -0600)
BFQ is already doing a similar thing in its .pd_offline_fn() method
implementation.

While it seems that after commit 4c6994806f70
("blk-throttle: fix race between blkcg_bio_issue_check() and cgroup_rmdir()")
was reverted leaving these pointers intact no longer causes crashes
clearing them is still a sensible thing to do to make the code more robust.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/cfq-iosched.c

index d219e9a1af652af3fac29336a6118e49a09fc46d..6a3d87dd3c1ac42abf04223ea14eb673e7c5ec5c 100644 (file)
@@ -1644,14 +1644,20 @@ static void cfq_pd_offline(struct blkg_policy_data *pd)
        int i;
 
        for (i = 0; i < IOPRIO_BE_NR; i++) {
-               if (cfqg->async_cfqq[0][i])
+               if (cfqg->async_cfqq[0][i]) {
                        cfq_put_queue(cfqg->async_cfqq[0][i]);
-               if (cfqg->async_cfqq[1][i])
+                       cfqg->async_cfqq[0][i] = NULL;
+               }
+               if (cfqg->async_cfqq[1][i]) {
                        cfq_put_queue(cfqg->async_cfqq[1][i]);
+                       cfqg->async_cfqq[1][i] = NULL;
+               }
        }
 
-       if (cfqg->async_idle_cfqq)
+       if (cfqg->async_idle_cfqq) {
                cfq_put_queue(cfqg->async_idle_cfqq);
+               cfqg->async_idle_cfqq = NULL;
+       }
 
        /*
         * @blkg is going offline and will be ignored by