From: David Zafman Date: Mon, 6 Jul 2015 23:35:16 +0000 (-0700) Subject: osd: fix temp clearing in OSD X-Git-Tag: v9.0.3~52^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fb22a9fa2fd6d268914d73f018c31760d22afa29;p=ceph.git osd: fix temp clearing in OSD Signed-off-by: David Zafman --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 6805cb2902f8..1ec11a89f96f 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2484,15 +2484,17 @@ void OSD::clear_temp_objects() 0, &objects, &next); if (objects.empty()) break; - for (vector::iterator q = objects.begin(); q != objects.end(); - ++q) { + vector::iterator q; + for (q = objects.begin(); q != objects.end(); ++q) { if (q->hobj.is_temp()) { temps.push_back(*q); } else { break; } } - if (!objects.empty()) + // If we saw a non-temp object and hit the break above we can + // break out of the while loop too. + if (q != objects.end()) break; } if (!temps.empty()) {