From d0c29d7d2c28b37448fe149f9ffbeed27a61be88 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 3 Nov 2010 14:02:30 -0700 Subject: [PATCH] mds: add 'mds verify scatter' and re-add some scatter asserts Check on ifile and inest gather that stats match single-frag dirs. Signed-off-by: Sage Weil --- src/config.cc | 1 + src/config.h | 1 + src/mds/CInode.cc | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/config.cc b/src/config.cc index ec95de4644036..c59fe5da9711e 100644 --- a/src/config.cc +++ b/src/config.cc @@ -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), diff --git a/src/config.h b/src/config.h index 6f872f4c4c864..4e8ce03f014c4 100644 --- a/src/config.h +++ b/src/config.h @@ -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; diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index 7e615943da7bc..2724249b35614 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -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); } } } -- 2.39.5