Skip to content

Commit

Permalink
osd/PG: wait for scan_snaps() mapper repair
Browse files Browse the repository at this point in the history
Wait for our repair to apply before continuing to avoid reading the
broken state again.

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit ea531df)

Conflicts:
	src/osd/PG.cc (luminous uses osd->store->apply_transaction() where
                      master has osd->store->queue_transaction())
  • Loading branch information
liewegas authored and smithfarm committed Mar 29, 2018
1 parent 6b11270 commit f491f02
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/osd/PG.cc
Expand Up @@ -4159,10 +4159,25 @@ void PG::_scan_snaps(ScrubMap &smap)
<< "...repaired";
}
snap_mapper.add_oid(hoid, obj_snaps, &_t);
r = osd->store->apply_transaction(osr.get(), std::move(t));
if (r != 0) {
derr << __func__ << ": apply_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->apply_transaction(osr.get(), std::move(t));
if (r != 0) {
derr << __func__ << ": apply_transaction got " << cpp_strerror(r)
<< dendl;
} else {
my_lock.Lock();
while (!done)
my_cond.Wait(my_lock);
my_lock.Unlock();
}
}
}
}
Expand Down

0 comments on commit f491f02

Please sign in to comment.