]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: report dirfrag stats error found by scrub
authorYan, Zheng <zyan@redhat.com>
Thu, 28 Jan 2016 12:59:58 +0000 (20:59 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 7 Mar 2016 07:59:13 +0000 (15:59 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/CDir.cc
src/mds/CDir.h
src/mds/CInode.cc

index 045e5b3e0b4498a944d19606eead8ea73b591a55..f216da465d3938b4e178dc663f2e4e1084f03e9d 100644 (file)
@@ -3074,6 +3074,7 @@ void CDir::scrub_maybe_delete_info()
       !scrub_infop->directory_scrubbing &&
       !scrub_infop->need_scrub_local &&
       !scrub_infop->last_scrub_dirty &&
+      !scrub_infop->pending_scrub_error &&
       scrub_infop->dirty_scrub_stamps.empty()) {
     delete scrub_infop;
     scrub_infop = NULL;
@@ -3085,15 +3086,17 @@ bool CDir::scrub_local()
   assert(is_complete());
   bool rval = check_rstats(true);
 
+  scrub_info();
   if (rval) {
-    scrub_info();
     scrub_infop->last_local.time = ceph_clock_now(g_ceph_context);
     scrub_infop->last_local.version = get_projected_version();
+    scrub_infop->pending_scrub_error = false;
     scrub_infop->last_scrub_dirty = true;
-  } else if (scrub_infop &&
-            scrub_infop->header &&
-            scrub_infop->header->repair) {
-    cache->repair_dirfrag_stats(this, NULL);
+  } else {
+    scrub_infop->pending_scrub_error = true;
+    if (scrub_infop->header &&
+       scrub_infop->header->repair)
+      cache->repair_dirfrag_stats(this, NULL);
   }
   return rval;
 }
index 81a1fa89d8aef7ea5491d28a9ef994098fc868fc..386d0d8ca67a3647818141c0980e6a7ac636bafc 100644 (file)
@@ -255,6 +255,7 @@ public:
     bool directory_scrubbing; /// safety check
     bool need_scrub_local;
     bool last_scrub_dirty; /// is scrub info dirty or is it flushed to fnode?
+    bool pending_scrub_error;
 
     /// these are lists of children in each stage of scrubbing
     set<dentry_key_t> directories_to_scrub;
@@ -267,8 +268,10 @@ public:
     ScrubHeaderRefConst header;
 
     scrub_info_t() :
-      directory_scrubbing(false), need_scrub_local(false),
-      last_scrub_dirty(false) {}
+      directory_scrubbing(false),
+      need_scrub_local(false),
+      last_scrub_dirty(false),
+      pending_scrub_error(false) {}
   };
   /**
    * Call to start this CDir on a new scrub.
index 966fa7ded64e1f98488c0e22fc66c136c19d0e1f..08135a093d2cc35d20eea37143c0c13970dc0a5f 100644 (file)
@@ -3913,6 +3913,7 @@ next:
     }
 
     bool _dirfrags(int rval) {
+      int frags_errors = 0;
       // basic reporting setup
       results->raw_stats.checked = true;
       results->raw_stats.ondisk_read_retval = rval;
@@ -3935,6 +3936,13 @@ next:
        assert(dir->get_version() > 0);
        nest_info.add(dir->fnode.accounted_rstat);
        dir_info.add(dir->fnode.accounted_fragstat);
+       if (dir->scrub_infop &&
+           dir->scrub_infop->pending_scrub_error) {
+         dir->scrub_infop->pending_scrub_error = false;
+         results->raw_stats.error_str
+           << "dirfrag(" << p->first << ") has bad stats; ";
+         frags_errors++;
+       }
       }
       nest_info.rsubdirs++; // it gets one to account for self
       // ...and that their sum matches our inode settings
@@ -3948,6 +3956,9 @@ next:
          in->mdcache->repair_inode_stats(in, NULL);
        goto next;
       }
+      if (frags_errors > 0)
+       goto next;
+
       results->raw_stats.passed = true;
 next:
       return true;