mds: add 'mds debug auth pins' option

This counts dirfrag auth_pins and ensure the inode's nested_auth_pins
count is correct.  Helped catch the bug fixed in the previous commit.

Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Sage Weil 2011-04-27 16:34:16 -07:00
parent d994e8b4b8
commit 0a80865f5c
4 changed files with 16 additions and 0 deletions

View File

@ -309,6 +309,7 @@ struct config_option config_optionsp[] = {
OPTION(mds_verify_scatter, OPT_BOOL, false),
OPTION(mds_debug_scatterstat, OPT_BOOL, false),
OPTION(mds_debug_frag, OPT_BOOL, false),
OPTION(mds_debug_auth_pins, OPT_BOOL, false),
OPTION(mds_kill_mdstable_at, OPT_INT, 0),
OPTION(mds_kill_export_at, OPT_INT, 0),
OPTION(mds_kill_import_at, OPT_INT, 0),

View File

@ -370,6 +370,7 @@ public:
bool mds_verify_scatter;
bool mds_debug_scatterstat;
bool mds_debug_frag;
bool mds_debug_auth_pins;
int mds_kill_mdstable_at;
int mds_kill_export_at;
int mds_kill_import_at;

View File

@ -2023,6 +2023,19 @@ void CInode::adjust_nested_auth_pins(int a)
<< dendl;
assert(nested_auth_pins >= 0);
if (g_conf.mds_debug_auth_pins) {
// audit
int s = 0;
for (map<frag_t,CDir*>::iterator p = dirfrags.begin();
p != dirfrags.end();
++p) {
CDir *dir = p->second;
if (dir->get_cum_auth_pins())
s++;
}
assert(s == nested_auth_pins);
}
if (parent)
parent->adjust_nested_auth_pins(a, 0);
}

View File

@ -278,6 +278,7 @@ EOF
$DAEMONOPTS
$CMDSDEBUG
mds debug frag = true
mds debug auth pins = true
[osd]
$DAEMONOPTS
osd class tmp = out