Skip to content

Commit b6553be

Browse files
Christoph Hellwigaxboe
authored andcommitted
Revert "blk-cgroup: delay blk-cgroup initialization until add_disk"
This reverts commit 178fa7d. Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent b4e94f9 commit b6553be

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

block/genhd.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,13 +466,9 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
466466
*/
467467
pm_runtime_set_memalloc_noio(ddev, true);
468468

469-
ret = blkcg_init_disk(disk);
470-
if (ret)
471-
goto out_del_block_link;
472-
473469
ret = blk_integrity_add(disk);
474470
if (ret)
475-
goto out_blkcg_exit;
471+
goto out_del_block_link;
476472

477473
disk->part0->bd_holder_dir =
478474
kobject_create_and_add("holders", &ddev->kobj);
@@ -538,8 +534,6 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
538534
kobject_put(disk->part0->bd_holder_dir);
539535
out_del_integrity:
540536
blk_integrity_del(disk);
541-
out_blkcg_exit:
542-
blkcg_exit_disk(disk);
543537
out_del_block_link:
544538
if (!sysfs_deprecated)
545539
sysfs_remove_link(block_depr, dev_name(ddev));
@@ -668,8 +662,6 @@ void del_gendisk(struct gendisk *disk)
668662
rq_qos_exit(q);
669663
blk_mq_unquiesce_queue(q);
670664

671-
blkcg_exit_disk(disk);
672-
673665
/*
674666
* If the disk does not own the queue, allow using passthrough requests
675667
* again. Else leave the queue frozen to fail all I/O.
@@ -1178,6 +1170,8 @@ static void disk_release(struct device *dev)
11781170
!test_bit(GD_ADDED, &disk->state))
11791171
blk_mq_exit_queue(disk->queue);
11801172

1173+
blkcg_exit_disk(disk);
1174+
11811175
bioset_exit(&disk->bio_split);
11821176

11831177
disk_release_events(disk);
@@ -1390,6 +1384,9 @@ struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id,
13901384
if (xa_insert(&disk->part_tbl, 0, disk->part0, GFP_KERNEL))
13911385
goto out_destroy_part_tbl;
13921386

1387+
if (blkcg_init_disk(disk))
1388+
goto out_erase_part0;
1389+
13931390
rand_initialize_disk(disk);
13941391
disk_to_dev(disk)->class = &block_class;
13951392
disk_to_dev(disk)->type = &disk_type;
@@ -1402,6 +1399,8 @@ struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id,
14021399
#endif
14031400
return disk;
14041401

1402+
out_erase_part0:
1403+
xa_erase(&disk->part_tbl, 0);
14051404
out_destroy_part_tbl:
14061405
xa_destroy(&disk->part_tbl);
14071406
disk->part0->bd_disk = NULL;

0 commit comments

Comments
 (0)