diff options
author | Alex Elder <elder@inktank.com> | 2013-02-06 13:11:38 -0600 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2013-02-19 19:14:05 -0600 |
commit | 23ed6e13b320b33decb516cbe66e71b132df488d (patch) | |
tree | 0e1cf9b6a06f1c5bd7ef3b2b8d40c566e607ef12 | |
parent | 1ceae7ef0fd00c965a2257c6e9eb497ca91f01c7 (diff) | |
download | linux-3.10-23ed6e13b320b33decb516cbe66e71b132df488d.tar.gz linux-3.10-23ed6e13b320b33decb516cbe66e71b132df488d.tar.bz2 linux-3.10-23ed6e13b320b33decb516cbe66e71b132df488d.zip |
rbd: ignore result of ceph_copy_from_page_vector()
The result of ceph_copy_from_page_vector() is simply the length
argument it is provided.
This is called by rbd_obj_method_sync(), which returns the result if
it's non-negative. But we always either ignore or overwrite that
return value. So explicitly ignore what's returned by the copy
function, and have rbd_obj_method_sync() always return either a
negative errno or 0.
We also return the result of ceph_copy_from_page_vector() in
rbd_obj_read_sync(). There we still want to return the number of
bytes transferred, but we can use the value we already have in hand
rather than what ceph_copy_from_page_vector() provides.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
-rw-r--r-- | drivers/block/rbd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 93369a1a08e..c259b4089e9 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1889,7 +1889,8 @@ static int rbd_obj_method_sync(struct rbd_device *rbd_dev, ret = obj_request->result; if (ret < 0) goto out; - ret = ceph_copy_from_page_vector(pages, inbound, 0, + ret = 0; + (void) ceph_copy_from_page_vector(pages, inbound, 0, obj_request->xferred); if (version) *version = obj_request->version; @@ -2088,7 +2089,9 @@ static int rbd_obj_read_sync(struct rbd_device *rbd_dev, rbd_assert(obj_request->xferred <= (u64) SIZE_MAX); size = (size_t) obj_request->xferred; - ret = ceph_copy_from_page_vector(pages, buf, 0, size); + (void) ceph_copy_from_page_vector(pages, buf, 0, size); + rbd_assert(size <= (size_t) INT_MAX); + ret = (int) size; if (version) *version = obj_request->version; out: @@ -2141,7 +2144,6 @@ rbd_dev_v1_header_read(struct rbd_device *rbd_dev, u64 *version) ret = rbd_obj_read_sync(rbd_dev, rbd_dev->header_name, 0, size, (char *) ondisk, version); - if (ret < 0) goto out_err; if (WARN_ON((size_t) ret < size)) { @@ -2803,7 +2805,6 @@ static int rbd_dev_v2_object_prefix(struct rbd_device *rbd_dev) dout("%s: rbd_obj_method_sync returned %d\n", __func__, ret); if (ret < 0) goto out; - ret = 0; /* rbd_obj_method_sync() can return positive */ p = reply_buf; rbd_dev->header.object_prefix = ceph_extract_encoded_string(&p, @@ -3742,7 +3743,6 @@ static int rbd_dev_image_id(struct rbd_device *rbd_dev) dout("%s: rbd_obj_method_sync returned %d\n", __func__, ret); if (ret < 0) goto out; - ret = 0; /* rbd_obj_method_sync() can return positive */ p = response; rbd_dev->spec->image_id = ceph_extract_encoded_string(&p, |