]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix io blocked accounting
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 19 Oct 2017 00:39:34 +0000 (17:39 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 10 Apr 2018 15:05:38 +0000 (08:05 -0700)
Now that we can have multiple IOs per coroutine, need to only decrease
num_blocked one time when switching from io blocked to unblocked. Also,
is_blocked() should not return true if is_done.

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

index 4fdf59aa3f0363ec7d231025b44b45a1b78b3b29..f4e1e0ab1dd07a02876bffe3d953e3ca40ae0f68 100644 (file)
@@ -224,6 +224,7 @@ int RGWCoroutinesStack::operate(RGWCoroutinesEnv *_env)
     r = unwind(op_retcode);
     op->put();
     done_flag = (pos == ops.end());
+    blocked_flag &= ~done_flag;
     if (done_flag) {
       retcode = op_retcode;
     }
@@ -321,6 +322,7 @@ int RGWCoroutinesStack::unwind(int retcode)
   rgw_spawned_stacks *src_spawned = &(*pos)->spawned;
 
   if (pos == ops.begin()) {
+    ldout(cct, 0) << "stack " << (void *)this << " end" << dendl;
     spawned.inherit(src_spawned);
     ops.clear();
     pos = ops.end();
@@ -505,11 +507,14 @@ void RGWCoroutinesManager::handle_unblocked_stack(set<RGWCoroutinesStack *>& con
   if (!stack->try_io_unblock(io.io_id)) {
     return;
   }
-  --(*blocked_count);
-  stack->set_io_blocked(false);
+  if (stack->is_io_blocked()) {
+    --(*blocked_count);
+    stack->set_io_blocked(false);
+  }
   stack->set_interval_wait(false);
   if (!stack->is_done()) {
     scheduled_stacks.push_back(stack);
+    stack->set_is_scheduled(true);
   } else {
     context_stacks.erase(stack);
     stack->put();
@@ -651,7 +656,7 @@ int RGWCoroutinesManager::run(list<RGWCoroutinesStack *>& stacks)
       ret = completion_mgr->get_next(&io);
       lock.get_write();
       if (ret < 0) {
-       ldout(cct, 0) << "ERROR: failed to clone shard, completion_mgr.get_next() returned ret=" << ret << dendl;
+       ldout(cct, 0) << "ERROR: completion_mgr.get_next() returned ret=" << ret << dendl;
       }
       handle_unblocked_stack(context_stacks, scheduled_stacks, io, &blocked_count);
     }
@@ -666,7 +671,7 @@ next:
       ret = completion_mgr->get_next(&io);
       lock.get_write();
       if (ret < 0) {
-       ldout(cct, 0) << "ERROR: failed to clone shard, completion_mgr.get_next() returned ret=" << ret << dendl;
+       ldout(cct, 0) << "ERROR: completion_mgr.get_next() returned ret=" << ret << dendl;
       }
       if (going_down) {
        ldout(cct, 5) << __func__ << "(): was stopped, exiting" << dendl;
index d83ccb55916aebc8eec0e09a74b8149220fd2eb9..25dc55660ea7da21277f1f8cc4f4aa794d342100 100644 (file)
@@ -413,7 +413,7 @@ public:
     io_blocked_id = io_id;
   }
   bool is_io_blocked() {
-    return blocked_flag;
+    return blocked_flag && !done_flag;
   }
   bool can_io_unblock(int64_t io_id) {
     return (io_blocked_id == io_id) ||