]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: For func op_cancel_writes it can directly call op_cancel.
authorJianpeng Ma <jianpeng.ma@intel.com>
Thu, 20 Aug 2015 07:38:58 +0000 (15:38 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Tue, 1 Sep 2015 00:45:19 +0000 (08:45 +0800)
Becasue we get write-lock of rwlock, so it is safe to call op_cancel
rather than _op_canchel(homeless_session for this case don't met).

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/osdc/Objecter.cc

index 53b3cdadfa3a79706091a4d21614bd9f25c85e58..22c122372a4601b36e3c2ae9e53c52934c08079f 100644 (file)
@@ -2319,6 +2319,7 @@ epoch_t Objecter::op_cancel_writes(int r, int64_t pool)
   rwlock.get_write();
 
   std::vector<ceph_tid_t> to_cancel;
+  bool found = false;
 
   for (map<int, OSDSession *>::iterator siter = osd_sessions.begin(); siter != osd_sessions.end(); ++siter) {
     OSDSession *s = siter->second;
@@ -2330,19 +2331,22 @@ epoch_t Objecter::op_cancel_writes(int r, int64_t pool)
       }
     }
     s->lock.unlock();
-  }
 
-  for (std::vector<ceph_tid_t>::iterator titer = to_cancel.begin(); titer != to_cancel.end(); ++titer) {
-    int cancel_result = _op_cancel(*titer, r);
-    // We hold rwlock across search and cancellation, so cancels should always succeed
-    assert(cancel_result == 0);
+    for (std::vector<ceph_tid_t>::iterator titer = to_cancel.begin(); titer != to_cancel.end(); ++titer) {
+      int cancel_result = op_cancel(s, *titer, r);
+      // We hold rwlock across search and cancellation, so cancels should always succeed
+      assert(cancel_result == 0);
+    }
+    if (!found && to_cancel.size())
+      found = true;
+    to_cancel.clear();
   }
 
   const epoch_t epoch = osdmap->get_epoch();
 
   rwlock.unlock();
 
-  if (to_cancel.size()) {
+  if (found) {
     return epoch;
   } else {
     return -1;