From: Yehuda Sadeh Date: Mon, 12 Jan 2015 16:55:35 +0000 (-0800) Subject: cls_rgw: call ioctx->aio_operate() under lock X-Git-Tag: v0.92~12^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d19a49d3321c9edbca1a8842fa7c08daa3ed6f69;p=ceph.git cls_rgw: call ioctx->aio_operate() under lock close a race window Signed-off-by: Yehuda Sadeh --- diff --git a/src/cls/rgw/cls_rgw_client.h b/src/cls/rgw/cls_rgw_client.h index 3341ad3ff76e..c54b3330b508 100644 --- a/src/cls/rgw/cls_rgw_client.h +++ b/src/cls/rgw/cls_rgw_client.h @@ -61,7 +61,6 @@ private: * track the object id per callback. */ void add_pending(int id, librados::AioCompletion* completion, string *oid = NULL) { - Mutex::Locker l(lock); pendings[id] = completion; if (oid) { pending_objs[id] = *oid; @@ -96,6 +95,7 @@ public: * Do aio read operation. */ bool aio_operate(librados::IoCtx& io_ctx, const string& oid, librados::ObjectReadOperation *op) { + Mutex::Locker l(lock); BucketIndexAioArg *arg = new BucketIndexAioArg(get_next(), this); librados::AioCompletion *c = librados::Rados::aio_create_completion((void*)arg, NULL, bucket_index_op_completion_cb); int r = io_ctx.aio_operate(oid, c, (librados::ObjectReadOperation*)op, NULL); @@ -109,6 +109,7 @@ public: * Do aio write operation. */ bool aio_operate(librados::IoCtx& io_ctx, const string& oid, librados::ObjectWriteOperation *op) { + Mutex::Locker l(lock); BucketIndexAioArg *arg = new BucketIndexAioArg(get_next(), this); librados::AioCompletion *c = librados::Rados::aio_create_completion((void*)arg, NULL, bucket_index_op_completion_cb); int r = io_ctx.aio_operate(oid, c, (librados::ObjectWriteOperation*)op);