Verify that the PG is still RECOVERING or BACKFILL when we take the pg
lock in the recovery thread. This prevents a crash from an invalid
state machine event when the recovery queue races with a PG state change
(e.g., due to peering).
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
} else {
pg->lock();
+
+ if (!pg->state_test(PG_STATE_RECOVERING) &&
+ !pg->state_test(PG_STATE_BACKFILL)) {
+ dout(10) << "do_recovery not recovering|backfill on " << *pg << dendl;
+ pg->unlock();
+ goto out;
+ }
dout(10) << "do_recovery starting " << max
<< " (" << recovery_ops_active << "/" << g_conf->osd_recovery_max_active << " rops) on "
}
pg->unlock();
}
+ out:
pg->put();
}
log.last_requested = 0;
}
+ state_set(PG_STATE_RECOVERING);
osd->queue_for_recovery(this);
}