X-Git-Url: https://git.stricted.de/?a=blobdiff_plain;f=block%2Fblk-cgroup.c;h=8c4e81ac5e75432c1e29917dd6bf0305505ad7a6;hb=4511a4e21fc6240773170a7bc3bbce3885c81d1a;hp=e8918ffaf96d4a0a2dacf75838b5d8a89e5e8ca3;hpb=c313d56754fee4eaed849f85a14044144bdd79c4;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index e8918ffaf96d..8c4e81ac5e75 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -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,20 @@ 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. + */ + if (!q->root_blkg) + return; + blk_throtl_drain(q); }