From 03b0d1cfb7bd30a77fedcf75eb06476b21b14e95 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 6 May 2014 11:06:29 -0700 Subject: [PATCH] rgw: cut short object read if a chunk returns error Fixes: #8289 Backport: firefly, dumpling When reading an object, if we hit an error when trying to read one of the rados objects then we should just stop. Otherwise we're just going to continue reading the rest of the object, and since it can't be sent back to the client (as we have a hole in the middle), we end up accumulating everything in memory. Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_rados.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 0ea7057f5bd58..902fcf857a8c0 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4839,8 +4839,16 @@ void RGWRados::get_obj_aio_completion_cb(completion_t c, void *arg) ldout(cct, 20) << "get_obj_aio_completion_cb: io completion ofs=" << ofs << " len=" << len << dendl; d->throttle.put(len); - if (d->is_cancelled()) + r = rados_aio_get_return_value(c); + if (r < 0) { + ldout(cct, 0) << "ERROR: got unexpected error when trying to read object: " << r << dendl; + d->set_cancelled(r); goto done; + } + + if (d->is_cancelled()) { + goto done; + } d->data_lock.Lock(); -- 2.39.5