From: Sage Weil Date: Mon, 22 Jan 2018 14:29:22 +0000 (-0600) Subject: osd/PG: wait for scan_snaps() mapper repair X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=665c71feaa3002dfcef01512c4cb6ee02798fcad;p=ceph.git osd/PG: wait for scan_snaps() mapper repair Wait for our repair to apply before continuing to avoid reading the broken state again. Signed-off-by: Sage Weil (cherry picked from commit ea531df216c65a3773a55b5f6c42af20e5004263) Conflicts: src/osd/PG.cc: trivial (oi_snaps vs obj_snaps) --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 12dd75d728149..a855c55499447 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -3915,10 +3915,25 @@ void PG::_scan_snaps(ScrubMap &smap) << "...repaired"; } snap_mapper.add_oid(hoid, oi_snaps, &_t); - r = osd->store->queue_transaction(osr.get(), std::move(t), nullptr); - if (r != 0) { - derr << __func__ << ": queue_transaction got " << cpp_strerror(r) - << dendl; + + // wait for repair to apply to avoid confusing other bits of the system. + { + Cond my_cond; + Mutex my_lock("PG::_scan_snaps my_lock"); + int r = 0; + bool done; + t.register_on_applied_sync( + new C_SafeCond(&my_lock, &my_cond, &done, &r)); + r = osd->store->queue_transaction(osr.get(), std::move(t), nullptr); + if (r != 0) { + derr << __func__ << ": queue_transaction got " << cpp_strerror(r) + << dendl; + } else { + my_lock.Lock(); + while (!done) + my_cond.Wait(my_lock); + my_lock.Unlock(); + } } } } else {