summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorJosh Durgin <josh.durgin@inktank.com>2013-06-12 14:43:10 -0700
committerSage Weil <sage@inktank.com>2013-06-25 12:27:31 -0700
commit1617e40c1eeeeb857ff4b66acee20ed2acc1b5e7 (patch)
tree9dc61d610aadb7fb43163ea22dca87df166fb79a /drivers/block
parent3a96d5cd7bdce45d5dded75c3a62d4fb98050280 (diff)
downloadlinux-stable-1617e40c1eeeeb857ff4b66acee20ed2acc1b5e7.tar.gz
linux-stable-1617e40c1eeeeb857ff4b66acee20ed2acc1b5e7.tar.bz2
linux-stable-1617e40c1eeeeb857ff4b66acee20ed2acc1b5e7.zip
rbd: fetch object order before using it
rbd_dev_v2_header_onetime() fetches striping information, and checks whether the image can be read by compariing the stripe unit to the object size. It determines the object size by shifting the object order, which is 0 at this point since it has not been read yet. Move the call to get the image size and object order before rbd_dev_v2_header_onetime() so it is set before use. Signed-off-by: Josh Durgin <josh.durgin@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index cc7c60e8f277..7c66173e2d83 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4245,6 +4245,10 @@ static int rbd_dev_v2_header_info(struct rbd_device *rbd_dev)
down_write(&rbd_dev->header_rwsem);
+ ret = rbd_dev_v2_image_size(rbd_dev);
+ if (ret)
+ goto out;
+
if (first_time) {
ret = rbd_dev_v2_header_onetime(rbd_dev);
if (ret)
@@ -4278,10 +4282,6 @@ static int rbd_dev_v2_header_info(struct rbd_device *rbd_dev)
"is EXPERIMENTAL!");
}
- ret = rbd_dev_v2_image_size(rbd_dev);
- if (ret)
- goto out;
-
if (rbd_dev->spec->snap_id == CEPH_NOSNAP)
if (rbd_dev->mapping.size != rbd_dev->header.image_size)
rbd_dev->mapping.size = rbd_dev->header.image_size;