arm: rockchip: rk3228: dts: add DMAC support
[firefly-linux-kernel-4.4.55.git] / block / blk-cgroup.c
index b95219d2168d0957eb2a537c920cac531d7238d7..8c4e81ac5e75432c1e29917dd6bf0305505ad7a6 100644 (file)
@@ -720,8 +720,12 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
                return -EINVAL;
 
        disk = get_gendisk(MKDEV(major, minor), &part);
-       if (!disk || part)
+       if (!disk)
                return -EINVAL;
+       if (part) {
+               put_disk(disk);
+               return -EINVAL;
+       }
 
        rcu_read_lock();
        spin_lock_irq(disk->queue->queue_lock);
@@ -876,6 +880,13 @@ void blkcg_drain_queue(struct request_queue *q)
 {
        lockdep_assert_held(q->queue_lock);
 
+       /*
+        * @q could be exiting and already have destroyed all blkgs as
+        * indicated by NULL root_blkg.  If so, don't confuse policies.
+        */
+       if (!q->root_blkg)
+               return;
+
        /*
         * @q could be exiting and already have destroyed all blkgs as
         * indicated by NULL root_blkg.  If so, don't confuse policies.