Commit bf91db18 authored by Cheng Renquan's avatar Cheng Renquan Committed by Jens Axboe

block: set disk->node_id before it's being used

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: default avatarCheng Renquan <crquan@gmail.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 53cc0b29
...@@ -1102,6 +1102,7 @@ struct gendisk *alloc_disk_node(int minors, int node_id) ...@@ -1102,6 +1102,7 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
kfree(disk); kfree(disk);
return NULL; return NULL;
} }
disk->node_id = node_id;
if (disk_expand_part_tbl(disk, 0)) { if (disk_expand_part_tbl(disk, 0)) {
free_part_stats(&disk->part0); free_part_stats(&disk->part0);
kfree(disk); kfree(disk);
...@@ -1116,7 +1117,6 @@ struct gendisk *alloc_disk_node(int minors, int node_id) ...@@ -1116,7 +1117,6 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
device_initialize(disk_to_dev(disk)); device_initialize(disk_to_dev(disk));
INIT_WORK(&disk->async_notify, INIT_WORK(&disk->async_notify,
media_change_notify_thread); media_change_notify_thread);
disk->node_id = node_id;
} }
return disk; return disk;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment