]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: repair backtraces during scrub 11578/head
authorJohn Spray <john.spray@redhat.com>
Thu, 20 Oct 2016 10:49:42 +0000 (11:49 +0100)
committerJohn Spray <john.spray@redhat.com>
Fri, 21 Oct 2016 10:34:55 +0000 (11:34 +0100)
Fixes: http://tracker.ceph.com/issues/17639
Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/CInode.cc

index 5dcdcb1577f2fabe64ba92f937131b9d427d140e..a4fc03b1403c9852e97b8323b29aac4022eb024e 100644 (file)
@@ -3813,6 +3813,9 @@ void CInode::validate_disk_state(CInode::validated_data *results,
       bool equivalent, divergent;
       int memory_newer;
 
+      MDCache *mdcache = in->mdcache;  // For the benefit of dout
+      const inode_t& inode = in->inode;  // For the benefit of dout
+
       // Ignore rval because it's the result of a FAILOK operation
       // from fetch_backtrace_and_tag: the real result is in
       // backtrace.ondisk_read_retval
@@ -3825,6 +3828,7 @@ void CInode::validate_disk_state(CInode::validated_data *results,
       try {
         bufferlist::iterator p = bl.begin();
         ::decode(results->backtrace.ondisk_value, p);
+        dout(10) << "decoded " << bl.length() << " bytes of backtrace successfully" << dendl;
       } catch (buffer::error&) {
         if (results->backtrace.ondisk_read_retval == 0 && rval != 0) {
           // Cases where something has clearly gone wrong with the overall
@@ -3851,11 +3855,19 @@ void CInode::validate_disk_state(CInode::validated_data *results,
         }
       }
 next:
+
+      if (!results->backtrace.passed && in->scrub_infop->header->get_repair()) {
+        std::string path;
+        in->make_path_string(path);
+        in->mdcache->mds->clog->warn() << "bad backtrace on inode " << *in
+                           << ", rewriting it at " << path;
+        in->_mark_dirty_parent(in->mdcache->mds->mdlog->get_current_segment(),
+                           false);
+      }
+
       // If the inode's number was free in the InoTable, fix that
       // (#15619)
       {
-        const inode_t& inode = in->inode;
-        MDCache *mdcache = in->mdcache;
         InoTable *inotable = mdcache->mds->inotable;
 
         dout(10) << "scrub: inotable ino = 0x" << std::hex << inode.ino << dendl;