]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: populate DamageTable from scrub and log more quietly 11136/head
authorJohn Spray <john.spray@redhat.com>
Mon, 19 Sep 2016 19:25:58 +0000 (20:25 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 22 Sep 2016 12:42:02 +0000 (13:42 +0100)
Fixes: http://tracker.ceph.com/issues/16016
Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/ScrubStack.cc

index 5c9993bac14fabfab92fd938a8b81fec2b359156..3448a496627fa0dd1b09ac839688768bdd1848fa 100644 (file)
@@ -366,16 +366,43 @@ void ScrubStack::scrub_file_inode(CInode *in)
 void ScrubStack::_validate_inode_done(CInode *in, int r,
                                      const CInode::validated_data &result)
 {
-  // FIXME: do something real with result!  DamageTable!  Spamming
-  // the cluster log for debugging purposes
   LogChannelRef clog = mdcache->mds->clog;
-  clog->info() << __func__ << " " << *in << " r=" << r;
-#if 0
-  assert(in->scrub_infop != NULL);
-  in->scrub_infop->inode_validated = true;
-#endif
   const ScrubHeaderRefConst header = in->scrub_info()->header;
 
+  if (result.backtrace.checked && !result.backtrace.passed) {
+    // Record backtrace fails as remote linkage damage, as
+    // we may not be able to resolve hard links to this inode
+    mdcache->mds->damage_table.notify_remote_damaged(in->inode.ino);
+  } else if (result.inode.checked && !result.inode.passed) {
+    // Record damaged inode structures as damaged dentries as
+    // that is where they are stored
+    auto parent = in->get_projected_parent_dn();
+    if (parent) {
+      auto dir = parent->get_dir();
+      mdcache->mds->damage_table.notify_dentry(
+          dir->inode->ino(), dir->frag, parent->last, parent->name);
+    }
+  }
+
+  // Inform the cluster log if we found an error
+  if (!result.passed_validation) {
+    std::string path;
+    in->make_path_string_projected(path);
+    clog->warn() << "Scrub error on inode " << *in
+                 << " (" << path << ") see " << g_conf->name
+                 << " log for details";
+
+    // Put the verbose JSON output into the MDS log for later inspection
+    JSONFormatter f;
+    result.dump(&f);
+    std::ostringstream out;
+    f.flush(out);
+    derr << __func__ << " scrub error on inode " << *in << ": " << out.str()
+         << dendl;
+  } else {
+    dout(10) << __func__ << " scrub passed on inode " << *in << dendl;
+  }
+
   MDSInternalContextBase *c = NULL;
   in->scrub_finished(&c);