From fb22a9fa2fd6d268914d73f018c31760d22afa29 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Mon, 6 Jul 2015 16:35:16 -0700 Subject: [PATCH] osd: fix temp clearing in OSD Signed-off-by: David Zafman --- src/osd/OSD.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 6805cb2902f81..1ec11a89f96f9 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()) { -- 2.39.5