Merge tag 'tif-task_work.arch-2020-12-14' of git://git.kernel.dk/linux-block
[linux-2.6-microblaze.git] / block / blk-cgroup.c
index f9b5561..54fbe1e 100644 (file)
@@ -657,13 +657,20 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
                        goto fail;
                }
 
+               if (radix_tree_preload(GFP_KERNEL)) {
+                       blkg_free(new_blkg);
+                       ret = -ENOMEM;
+                       goto fail;
+               }
+
                rcu_read_lock();
                spin_lock_irq(&q->queue_lock);
 
                blkg = blkg_lookup_check(pos, pol, q);
                if (IS_ERR(blkg)) {
                        ret = PTR_ERR(blkg);
-                       goto fail_unlock;
+                       blkg_free(new_blkg);
+                       goto fail_preloaded;
                }
 
                if (blkg) {
@@ -672,10 +679,12 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
                        blkg = blkg_create(pos, q, new_blkg);
                        if (IS_ERR(blkg)) {
                                ret = PTR_ERR(blkg);
-                               goto fail_unlock;
+                               goto fail_preloaded;
                        }
                }
 
+               radix_tree_preload_end();
+
                if (pos == blkcg)
                        goto success;
        }
@@ -685,6 +694,8 @@ success:
        ctx->body = input;
        return 0;
 
+fail_preloaded:
+       radix_tree_preload_end();
 fail_unlock:
        spin_unlock_irq(&q->queue_lock);
        rcu_read_unlock();
@@ -838,6 +849,7 @@ static void blkcg_fill_root_iostats(void)
                        blkg_iostat_set(&blkg->iostat.cur, &tmp);
                        u64_stats_update_end(&blkg->iostat.sync);
                }
+               disk_put_part(part);
        }
 }