]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: clean up clog damage message when repairing
authorJohn Spray <john.spray@redhat.com>
Wed, 25 Oct 2017 13:39:15 +0000 (09:39 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Tue, 6 Feb 2018 17:50:01 +0000 (09:50 -0800)
If we've repaired then we don't need to be at WRN
and we don't need to advise the user to look up
the damage detail.

Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit 3160ef2c0a66324621a95926bed0416bbd537353)

src/mds/CInode.cc
src/mds/CInode.h
src/mds/ScrubStack.cc

index 39d41547f9208e34dfb309395c604003952b0133..2064eb9fe9e12ef7318850a4528f6c4efbd4f5bc 100644 (file)
@@ -4095,6 +4095,7 @@ next:
            dir->scrub_infop->pending_scrub_error) {
          dir->scrub_infop->pending_scrub_error = false;
          if (dir->scrub_infop->header->get_repair()) {
+            results->raw_stats.repaired = true;
            results->raw_stats.error_str
              << "dirfrag(" << p->first << ") has bad stats (will be fixed); ";
          } else {
@@ -4113,6 +4114,7 @@ next:
          results->raw_stats.error_str
            << "freshly-calculated rstats don't match existing ones (will be fixed)";
          in->mdcache->repair_inode_stats(in);
+          results->raw_stats.repaired = true;
        } else {
          results->raw_stats.error_str
            << "freshly-calculated rstats don't match existing ones";
@@ -4187,6 +4189,18 @@ void CInode::validated_data::dump(Formatter *f) const
   f->close_section(); // results
 }
 
+bool CInode::validated_data::all_damage_repaired() const
+{
+  bool unrepaired =
+    (raw_stats.checked && !raw_stats.passed && !raw_stats.repaired)
+    ||
+    (backtrace.checked && !backtrace.passed && !backtrace.repaired)
+    ||
+    (inode.checked && !inode.passed && !inode.repaired);
+
+  return !unrepaired;
+}
+
 void CInode::dump(Formatter *f) const
 {
   InodeStoreBase::dump(f);
index 060ba505a19cf5eb47b6aef073921257bef9825c..6922ee989cf5d97f7e289f82cc4c2d809498ebb5 100644 (file)
@@ -1132,6 +1132,8 @@ public:
         passed_validation(false) {}
 
     void dump(Formatter *f) const;
+
+    bool all_damage_repaired() const;
   };
 
   /**
index 83ae53abe3336f4af234b2f35c2d327f5c553ea6..cb31a93f0fd64ed19cde4c194a3cd418323ac892 100644 (file)
@@ -396,9 +396,14 @@ void ScrubStack::_validate_inode_done(CInode *in, int r,
 
   // Inform the cluster log if we found an error
   if (!result.passed_validation) {
-    clog->warn() << "Scrub error on inode " << in->ino()
-                 << " (" << path << ") see " << g_conf->name
-                 << " log and `damage ls` output for details";
+    if (result.all_damage_repaired()) {
+      clog->info() << "Scrub repaired inode " << in->ino()
+                   << " (" << path << ")";
+    } else {
+      clog->warn() << "Scrub error on inode " << in->ino()
+                   << " (" << path << ") see " << g_conf->name
+                   << " log and `damage ls` output for details";
+    }
 
     // Put the verbose JSON output into the MDS log for later inspection
     JSONFormatter f;