diff options
author | Alex Elder <elder@inktank.com> | 2012-10-11 00:19:13 -0400 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2012-10-26 18:18:08 -0400 |
commit | a0ea3a40fd20b8c66381f747c454f89d6d1f50d4 (patch) | |
tree | 044dcaf850e2adf158deeea3a8091cba6a5a2e10 /drivers/block/rbd.c | |
parent | b213e0b1a62637b2a9395a34349b13d73ca2b90a (diff) |
rbd: zero return code in rbd_dev_image_id()
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>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r-- | drivers/block/rbd.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 4a16464ad5bb..94d613208c4f 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -2207,6 +2207,7 @@ static int rbd_dev_v2_object_prefix(struct rbd_device *rbd_dev) | |||
2207 | dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret); | 2207 | dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret); |
2208 | if (ret < 0) | 2208 | if (ret < 0) |
2209 | goto out; | 2209 | goto out; |
2210 | ret = 0; /* rbd_req_sync_exec() can return positive */ | ||
2210 | 2211 | ||
2211 | p = reply_buf; | 2212 | p = reply_buf; |
2212 | rbd_dev->header.object_prefix = ceph_extract_encoded_string(&p, | 2213 | rbd_dev->header.object_prefix = ceph_extract_encoded_string(&p, |
@@ -2900,6 +2901,7 @@ static int rbd_dev_image_id(struct rbd_device *rbd_dev) | |||
2900 | dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret); | 2901 | dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret); |
2901 | if (ret < 0) | 2902 | if (ret < 0) |
2902 | goto out; | 2903 | goto out; |
2904 | ret = 0; /* rbd_req_sync_exec() can return positive */ | ||
2903 | 2905 | ||
2904 | p = response; | 2906 | p = response; |
2905 | rbd_dev->image_id = ceph_extract_encoded_string(&p, | 2907 | rbd_dev->image_id = ceph_extract_encoded_string(&p, |