summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2013-09-10 12:18:55 -0700
committerYehuda Sadeh <yehuda@inktank.com>2013-09-10 12:18:55 -0700
commit1fad44341ea67a07af283a529793c0836f90b2f0 (patch)
tree323b87b3c37741334151dd1e25295fbc49b7e993
parent616d4cb530520021b592aebc8ecdc2b68fef6730 (diff)
downloadceph-wip-6268-bobtail.tar.gz
rgw: drain pending requests before completing writewip-6268-bobtail
Fixes: #6268 When doing aio write of objects (either regular or multipart parts) we need to drain pending aio requests. Otherwise if gateway goes down then object might end up corrupted. Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r--src/rgw/rgw_op.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc
index 803ca3c21ab..38260ef0efa 100644
--- a/src/rgw/rgw_op.cc
+++ b/src/rgw/rgw_op.cc
@@ -979,11 +979,11 @@ class RGWPutObjProcessor_Aio : public RGWPutObjProcessor
struct put_obj_aio_info pop_pending();
int wait_pending_front();
bool pending_has_completed();
- int drain_pending();
protected:
uint64_t obj_len;
+ int drain_pending();
int handle_obj_data(rgw_obj& obj, bufferlist& bl, off_t ofs, off_t abs_ofs, void **phandle);
int throttle_data(void *handle);
@@ -1174,8 +1174,12 @@ int RGWPutObjProcessor_Atomic::do_complete(string& etag, map<string, bufferlist>
store->set_atomic(s->obj_ctx, head_obj);
- int r = store->put_obj_meta(s->obj_ctx, head_obj, obj_len, NULL, attrs,
- RGW_OBJ_CATEGORY_MAIN, PUT_OBJ_CREATE, NULL, &first_chunk, &manifest, NULL, NULL);
+ int r = drain_pending();
+ if (r < 0)
+ return r;
+
+ r = store->put_obj_meta(s->obj_ctx, head_obj, obj_len, NULL, attrs,
+ RGW_OBJ_CATEGORY_MAIN, PUT_OBJ_CREATE, NULL, &first_chunk, &manifest, NULL, NULL);
return r;
}
@@ -1220,7 +1224,11 @@ int RGWPutObjProcessor_Multipart::do_complete(string& etag, map<string, bufferli
{
complete_parts();
- int r = store->put_obj_meta(s->obj_ctx, head_obj, s->obj_size, NULL, attrs, RGW_OBJ_CATEGORY_MAIN, 0, NULL, NULL, NULL, NULL, NULL);
+ int r = drain_pending();
+ if (r < 0)
+ return r;
+
+ r = store->put_obj_meta(s->obj_ctx, head_obj, s->obj_size, NULL, attrs, RGW_OBJ_CATEGORY_MAIN, 0, NULL, NULL, NULL, NULL, NULL);
if (r < 0)
return r;