blkcg: fix edge case for blk_get_rl() under memory pressure
[sfrench/cifs-2.6.git] / include / linux / blk-cgroup.h
index b7fd08013de281b3bd387373424456ba5fa8369c..1e76ceebeb5dc58c7f98e9f1d18d65fbe62477ef 100644 (file)
@@ -597,7 +597,7 @@ static inline struct request_list *blk_get_rl(struct request_queue *q,
        if (unlikely(!blkg))
                blkg = __blkg_lookup_create(blkcg, q);
 
-       if (!blkg_tryget(blkg))
+       if (blkg->blkcg == &blkcg_root || !blkg_tryget(blkg))
                goto rl_use_root;
 
        rcu_read_unlock();