]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
rbd: fetch object order before using it
authorJosh Durgin <josh.durgin@inktank.com>
Wed, 12 Jun 2013 21:43:10 +0000 (14:43 -0700)
committerSage Weil <sage@inktank.com>
Mon, 17 Jun 2013 02:51:01 +0000 (19:51 -0700)
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>
drivers/block/rbd.c

index 6efb7e579c47312dc385c056c94dc6d509ecd8f3..f24e241bb44f849a786746a5b95a718054aebdfe 100644 (file)
@@ -4290,6 +4290,10 @@ static int rbd_dev_v2_header_info(struct rbd_device *rbd_dev)
        bool first_time = rbd_dev->header.object_prefix == NULL;
        int ret;
 
+       ret = rbd_dev_v2_image_size(rbd_dev);
+       if (ret)
+               return ret;
+
        if (first_time) {
                ret = rbd_dev_v2_header_onetime(rbd_dev);
                if (ret)
@@ -4323,10 +4327,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)
-               return ret;
-
        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;