]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: wait for scan_snaps() mapper repair
authorSage Weil <sage@redhat.com>
Mon, 22 Jan 2018 14:29:22 +0000 (08:29 -0600)
committerSage Weil <sage@redhat.com>
Tue, 13 Mar 2018 21:37:57 +0000 (16:37 -0500)
Wait for our repair to apply before continuing to avoid reading the
broken state again.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PG.cc

index 744cde166f23e199260e41110bd4fa7c8a14b1be..def3114e7acc3d503a165f90e161f514383f5d06 100644 (file)
@@ -4179,10 +4179,25 @@ void PG::_scan_snaps(ScrubMap &smap)
                            << "...repaired";
        }
        snap_mapper.add_oid(hoid, obj_snaps, &_t);
-       r = osd->store->queue_transaction(ch, std::move(t));
-       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(ch, std::move(t));
+         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();
+         }
        }
       }
     }