]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: fix linger_ops iterator invalidation on pool deletion
authorSage Weil <sage@inktank.com>
Mon, 7 Jan 2013 20:58:39 +0000 (12:58 -0800)
committerSage Weil <sage@inktank.com>
Mon, 7 Jan 2013 21:01:38 +0000 (13:01 -0800)
The call to check_linger_pool_dne() may unregister the linger request,
invalidating the iterator.  To avoid this, increment the iterator at
the top of the loop.

This mirror the fix in 4bf9078286d58c2cd4e85cb8b31411220a377092 for
regular non-linger ops.

Fixes: #3734
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
(cherry picked from commit 62586884afd56f2148205bdadc5a67037a750a9b)

src/osdc/Objecter.cc

index 04a74b87b66bace753ae69e9f7b3afa1b3eeb940..339499fd96a32c425ff868452a3b6ec332f57c1f 100644 (file)
@@ -399,10 +399,10 @@ void Objecter::scan_requests(bool skipped_map,
                             list<LingerOp*>& need_resend_linger)
 {
   // check for changed linger mappings (_before_ regular ops)
-  for (map<tid_t,LingerOp*>::iterator p = linger_ops.begin();
-       p != linger_ops.end();
-       p++) {
-    LingerOp *op = p->second;
+  map<tid_t,LingerOp*>::iterator lp = linger_ops.begin();
+  while (lp != linger_ops.end()) {
+    LingerOp *op = lp->second;
+    ++lp;   // check_linger_pool_dne() may touch linger_ops; prevent iterator invalidation
     ldout(cct, 10) << " checking linger op " << op->linger_id << dendl;
     int r = recalc_linger_op_target(op);
     switch (r) {