]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: add 'mds verify scatter' and re-add some scatter asserts
authorSage Weil <sage@newdream.net>
Wed, 3 Nov 2010 21:02:30 +0000 (14:02 -0700)
committerSage Weil <sage@newdream.net>
Wed, 3 Nov 2010 21:47:32 +0000 (14:47 -0700)
Check on ifile and inest gather that stats match single-frag dirs.

Signed-off-by: Sage Weil <sage@newdream.net>
src/config.cc
src/config.h
src/mds/CInode.cc

index ec95de4644036f21696c40e56b4518fa0e7b9342..c59fe5da9711e9f19823801a6370d63e5ed72e9e 100644 (file)
@@ -480,6 +480,7 @@ static struct config_option config_optionsp[] = {
        OPTION(mds_dump_cache_on_map, 0, OPT_BOOL, false),
        OPTION(mds_dump_cache_after_rejoin, 0, OPT_BOOL, false),
        OPTION(mds_hack_log_expire_for_better_stats, 0, OPT_BOOL, false),
+       OPTION(mds_verify_scatter, 0, OPT_BOOL, false),
        OPTION(mds_kill_mdstable_at, 0, OPT_INT, 0),
        OPTION(mds_kill_export_at, 0, OPT_INT, 0),
        OPTION(mds_kill_import_at, 0, OPT_INT, 0),
index 6f872f4c4c8648e4887d6d868feb76e36ee24ab3..4e8ce03f014c4dd4606d0839e5cd544b14a169e7 100644 (file)
@@ -311,6 +311,7 @@ struct md_config_t {
   bool mds_hack_log_expire_for_better_stats;
 
   // set these to non-zero to specify kill points
+  bool mds_verify_scatter;
   int mds_kill_mdstable_at;
   int mds_kill_export_at;
   int mds_kill_import_at;
index 7e615943da7bc42a76fab4a0070b260f617c6988..2724249b3561404f77831b7bca373fe1cd2fe7bc 100644 (file)
@@ -1562,6 +1562,21 @@ void CInode::finish_scatter_gather_update(int type)
            dout(20) << fg << " skipping OLD accounted_fragstat " << pf->accounted_fragstat << dendl;
          }
          pf->fragstat.version = pf->accounted_fragstat.version = pi->dirstat.version + 1;
+
+         if (fg == frag_t()) { // i.e., we are the only frag
+           if (pi->dirstat.size() != pf->fragstat.size()) {
+             stringstream ss;
+             ss << "unmatched fragstat size on single dirfrag " << dir->dirfrag()
+                << ", inode has " << pi->dirstat << ", dirfrag has " << pf->fragstat;
+             mdcache->mds->logclient.log(LOG_ERROR, ss);
+             
+             // trust the dirfrag for now
+             pi->dirstat = pf->fragstat;
+             pi->dirstat.version--;  // (about to re-increment it below!)
+
+             assert(!!"unmatched fragstat size" == g_conf.mds_verify_scatter);
+           }
+         }
        }
       }
       if (touched_mtime)
@@ -1626,7 +1641,8 @@ void CInode::finish_scatter_gather_update(int type)
              // trust the dirfrag for now
              pi->rstat = pf->rstat;
              pi->rstat.version--;  // (about to re-increment it below!)
-             //assert("unmatched rstat rbytes" == 0);
+
+             assert(!!"unmatched rstat rbytes" == g_conf.mds_verify_scatter);
            }
          }
        }