block: set disk->node_id before it's being used
authorCheng Renquan <crquan@gmail.com>
Thu, 20 Nov 2008 07:37:37 +0000 (08:37 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 3 Dec 2008 11:41:20 +0000 (12:41 +0100)
disk->node_id will be refered in allocating in disk_expand_part_tbl, so we
should set it before disk->node_id is refered.

Signed-off-by: Cheng Renquan <crquan@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/genhd.c

index 27549e4..2f7feda 100644 (file)
@@ -1102,6 +1102,7 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
                        kfree(disk);
                        return NULL;
                }
+               disk->node_id = node_id;
                if (disk_expand_part_tbl(disk, 0)) {
                        free_part_stats(&disk->part0);
                        kfree(disk);
@@ -1116,7 +1117,6 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
                device_initialize(disk_to_dev(disk));
                INIT_WORK(&disk->async_notify,
                        media_change_notify_thread);
-               disk->node_id = node_id;
        }
        return disk;
 }