Skip to content

Commit

Permalink
block: call blk_integrity_add earlier in device_add_disk
Browse files Browse the repository at this point in the history
Doing all the sysfs file creation before adding the bdev and thus
allowing it to be opened will simplify the about to be added error
handling.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Link: https://lore.kernel.org/r/20210818144542.19305-6-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Aug 23, 2021
1 parent 9d5ee67 commit bab53f6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@ void device_add_disk(struct device *parent, struct gendisk *disk,
*/
pm_runtime_set_memalloc_noio(ddev, true);

blk_integrity_add(disk);

disk->part0->bd_holder_dir =
kobject_create_and_add("holders", &ddev->kobj);
disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj);
Expand Down Expand Up @@ -538,7 +540,6 @@ void device_add_disk(struct device *parent, struct gendisk *disk,
blk_register_queue(disk);

disk_add_events(disk);
blk_integrity_add(disk);
}
EXPORT_SYMBOL(device_add_disk);

Expand Down

0 comments on commit bab53f6

Please sign in to comment.