This appears to be caused by setting the capacity with set_capacity()
before adding the disk. According to this mailing list, add_disk
should be called on a gendisk with gendisk->capacity = 0
, otherwise it hangs in check_partition()
.
The following appears to work:
set_capacity(gendisk, 0)
add_disk(gendisk);
set_capacity(gendisk, dev->nsectors);