]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Avoid confusion over legacy snaps when head_exists corrupt
authorDavid Zafman <dzafman@redhat.com>
Tue, 8 Aug 2017 14:22:33 +0000 (07:22 -0700)
committerDavid Zafman <dzafman@redhat.com>
Thu, 10 Aug 2017 23:03:35 +0000 (16:03 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 1fe6cb0f0243eac384803d1a6e4a67c51090e94c)

qa/standalone/scrub/osd-scrub-snaps.sh
src/osd/PG.cc
src/osd/PrimaryLogPG.cc

index 2c647845709364eae8d3f961bc6d71c6a2465d96..8fa348ec6b7dbcd10f1512bb3a02fd9f5a7661a3 100755 (executable)
@@ -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
index e0707efe2d581bf8ce1ca81ff5c3ab2391e8c01c..371e638080073f2c9f5efcc02a3a9a1b2d3e2391 100644 (file)
@@ -4015,6 +4015,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) {
index dbacb3c63c0f30bb34772f2d45ccf10138d4a0d6..6e50990addda35bb1b3d0d5ec2c3d8dfb0e5119c 100644 (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) {