From: Kay Sievers on
From: Kay Sievers <kay.sievers(a)>
Subject: block: move blk_register_queue() before uevent is send out

Sysfs attributes should be created before the device is announced to
userspace. Createing attributes after the event makes it impossible
to use them reliably from udev.

The issue was found by Karel.

Cc: Karel Zak <kzak(a)>
Signed-Off-By: Kay Sievers <kay.sievers(a)>
block/genhd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/block/genhd.c
+++ b/block/genhd.c
@@ -531,6 +531,7 @@ static void register_disk(struct gendisk
disk->part0.holder_dir = kobject_create_and_add("holders", &ddev->kobj);
disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj);
+ blk_register_queue(disk);

/* No minors to use for partitions */
if (!disk_partitionable(disk))
@@ -602,7 +603,6 @@ void add_disk(struct gendisk *disk)
blk_register_region(disk_devt(disk), disk->minors, NULL,
exact_match, exact_lock, disk);
- blk_register_queue(disk);

bdi = &disk->queue->backing_dev_info;
bdi_register_dev(bdi, disk_devt(disk));

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)
More majordomo info at
Please read the FAQ at