From: Alex Elder Date: Fri, 26 Apr 2013 20:44:36 +0000 (-0500) Subject: rbd: defer setting disk capacity X-Git-Tag: firefly_0821_release~3680^2~249^2~82 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b5156e76da01c23e14e962594553f1735b1db298;p=firefly-linux-kernel-4.4.55.git rbd: defer setting disk capacity Don't set the disk capacity until right before we announce the device as available for use. Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index f84a11ed25a4..b6024a2d7b86 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -3147,8 +3147,6 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) rbd_dev->disk = disk; - set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); - return 0; out_disk: put_disk(disk); @@ -4784,6 +4782,7 @@ static int rbd_dev_probe_finish(struct rbd_device *rbd_dev) /* Everything's ready. Announce the disk to the world. */ + set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); set_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags); add_disk(rbd_dev->disk);