]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls_rgw: call ioctx->aio_operate() under lock
authorYehuda Sadeh <yehuda@redhat.com>
Mon, 12 Jan 2015 16:55:35 +0000 (08:55 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 14 Jan 2015 03:21:32 +0000 (19:21 -0800)
close a race window

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/cls/rgw/cls_rgw_client.h

index 3341ad3ff76eff9c10b386b4f50e5216d18f749b..c54b3330b5081099e77920e9c3e5a45387a3a93d 100644 (file)
@@ -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);