Skip to content

Commit

Permalink
rbd: zero return code in rbd_dev_image_id()
Browse files Browse the repository at this point in the history
When rbd_dev_probe() calls rbd_dev_image_id() it expects to get
a 0 return code if successful, but it is getting a positive value.

The reason is that rbd_dev_image_id() returns the value it gets from
rbd_req_sync_exec(), which returns the number of bytes read in as a
result of the request.  (This ultimately comes from
ceph_copy_from_page_vector() in rbd_req_sync_op()).

Force the return value to 0 when successful in rbd_dev_image_id().
Do the same in rbd_dev_v2_object_prefix().

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
  • Loading branch information
Alex Elder committed Oct 26, 2012
1 parent b213e0b commit a0ea3a4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2207,6 +2207,7 @@ static int rbd_dev_v2_object_prefix(struct rbd_device *rbd_dev)
dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret);
if (ret < 0)
goto out;
ret = 0; /* rbd_req_sync_exec() can return positive */

p = reply_buf;
rbd_dev->header.object_prefix = ceph_extract_encoded_string(&p,
Expand Down Expand Up @@ -2900,6 +2901,7 @@ static int rbd_dev_image_id(struct rbd_device *rbd_dev)
dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret);
if (ret < 0)
goto out;
ret = 0; /* rbd_req_sync_exec() can return positive */

p = response;
rbd_dev->image_id = ceph_extract_encoded_string(&p,
Expand Down

0 comments on commit a0ea3a4

Please sign in to comment.