From: Jianpeng Ma Date: Thu, 20 Aug 2015 07:38:58 +0000 (+0800) Subject: osdc/Objecter: For func op_cancel_writes it can directly call op_cancel. X-Git-Tag: v0.94.6~86^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d815e0aacb4a516f4bbbb59a2b2073b38759d9e8;p=ceph.git osdc/Objecter: For func op_cancel_writes it can directly call op_cancel. 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 (cherry picked from commit e4ce619fe17a7a9dfc18e6af0b84928aa2d88c00) Conflicts: src/osdc/Objecter.cc: the last if (found) was incorrectly implemented as if (to_cancel.size()) after hammer. The conflict is because the patch tries to revert an incorrect if (to_cancel.size()) which is not in hammer. --- diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 856425af955..5d2d62eaa2e 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -2279,6 +2279,7 @@ epoch_t Objecter::op_cancel_writes(int r) rwlock.get_write(); std::vector to_cancel; + bool found = false; for (map::iterator siter = osd_sessions.begin(); siter != osd_sessions.end(); ++siter) { OSDSession *s = siter->second; @@ -2289,19 +2290,26 @@ epoch_t Objecter::op_cancel_writes(int r) } } s->lock.unlock(); - } - for (std::vector::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::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(); - return epoch; + if (found) { + return epoch; + } else { + return -1; + } } bool Objecter::is_pg_changed(