diff options
author | Alex Elder <elder@inktank.com> | 2012-08-29 17:11:07 -0500 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2012-10-01 14:30:52 -0500 |
commit | 0f308a3188b37f36bc5a078f5fe039a41714476e (patch) | |
tree | 89a847eb16afdea9712f8fbbdf7086e57762baaf /drivers/block/rbd.c | |
parent | 85ae8926751db5e09b9a12ee44609ee9e74b7aad (diff) |
rbd: call rbd_init_disk() sooner
Call rbd_init_disk() from rbd_add() as soon as we have the major
device number for the mapping.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r-- | drivers/block/rbd.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 7a600ca2dbc..27988045b48 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2623,10 +2623,16 @@ static ssize_t rbd_add(struct bus_type *bus, goto err_out_id; rbd_dev->major = rc; - rc = rbd_bus_add_dev(rbd_dev); + /* Set up the blkdev mapping. */ + + rc = rbd_init_disk(rbd_dev); if (rc) goto err_out_blkdev; + rc = rbd_bus_add_dev(rbd_dev); + if (rc) + goto err_out_disk; + /* * At this point cleanup in the event of an error is the job * of the sysfs code (initiated by rbd_bus_del_dev()). @@ -2638,12 +2644,6 @@ static ssize_t rbd_add(struct bus_type *bus, if (rc) goto err_out_bus; - /* Set up the blkdev mapping. */ - - rc = rbd_init_disk(rbd_dev); - if (rc) - goto err_out_bus; - /* Everything's ready. Announce the disk to the world. */ set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); @@ -2664,6 +2664,8 @@ err_out_bus: kfree(options); return rc; +err_out_disk: + rbd_free_disk(rbd_dev); err_out_blkdev: unregister_blkdev(rbd_dev->major, rbd_dev->name); err_out_id: |