osd: Avoid confusion over legacy snaps when head_exists corrupt

Signed-off-by: David Zafman <dzafman@redhat.com>
This commit is contained in:
David Zafman 2017-08-08 07:22:33 -07:00
parent c140457489
commit 1fe6cb0f02
3 changed files with 8 additions and 2 deletions

View File

@ -450,9 +450,8 @@ EOF
err_strings[19]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 .*:::obj9:1 is missing in clone_size"
err_strings[20]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 .*:::obj11:1 is an unexpected clone"
err_strings[21]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 .*:::obj14:1 size 1032 != clone_size 1033"
err_strings[22]="log_channel[(]cluster[)] log [[]ERR[]] : [0-9]*[.]0 scrub 23 errors"
err_strings[22]="log_channel[(]cluster[)] log [[]ERR[]] : [0-9]*[.]0 scrub 22 errors"
err_strings[23]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 .*:::obj15:head can't decode 'snapset' attr buffer"
err_strings[24]="log_channel[(]cluster[)] log [[]ERR[]] : scrub [0-9]*[.]0 .*:::obj12:1 has no oi or legacy_snaps; cannot convert 1=[[]1[]]:[[]1[]].stray_clone_snaps=[{]1=[[]1[]][}]"
for i in `seq 0 ${#err_strings[@]}`
do

View File

@ -3992,6 +3992,9 @@ void PG::_scan_snaps(ScrubMap &smap)
continue;
}
head = hoid.get_head();
// Make sure head_exists is correct for is_legacy() check
if (hoid.is_head())
snapset.head_exists = true;
continue;
}
if (hoid.snap < CEPH_MAXSNAP) {

View File

@ -13893,12 +13893,16 @@ void PrimaryLogPG::scrub_snapshot_metadata(
<< " snapset.head_exists=false, but head exists";
++scrubber.shallow_errors;
head_error.set_head_mismatch();
// Fix head_exists locally so is_legacy() returns correctly
snapset->head_exists = true;
}
if (soid.is_snapdir() && snapset->head_exists) {
osd->clog->error() << mode << " " << info.pgid << " " << soid
<< " snapset.head_exists=true, but snapdir exists";
++scrubber.shallow_errors;
head_error.set_head_mismatch();
// For symmetry fix this too, but probably doesn't matter
snapset->head_exists = false;
}
if (get_osdmap()->require_osd_release >= CEPH_RELEASE_LUMINOUS) {