blk-cgroup: hold the queue ref during throttling
authorJosef Bacik <josef@toxicpanda.com>
Tue, 31 Jul 2018 16:39:03 +0000 (12:39 -0400)
committerJens Axboe <axboe@kernel.dk>
Wed, 1 Aug 2018 15:16:03 +0000 (09:16 -0600)
The blkg lifetime is protected by the queue lifetime, so we need to put
the queue _after_ we're done using the blkg.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-cgroup.c

index 1942357d7165d229381a46ec6120380d54b24ed5..694595b29b8fd2faac52ac79cf9e6e4540e7dcd6 100644 (file)
@@ -1759,10 +1759,10 @@ void blkcg_maybe_throttle_current(void)
        if (!blkg)
                goto out;
        rcu_read_unlock();
-       blk_put_queue(q);
 
        blkcg_maybe_throttle_blkg(blkg, use_memdelay);
        blkg_put(blkg);
+       blk_put_queue(q);
        return;
 out:
        rcu_read_unlock();