From 212cb785f836c467cc5c97c1f33bbc80bcc9df6f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 3 Mar 2009 10:42:10 -0800 Subject: [PATCH] mds: clean up auth_pin nesting code a bit --- src/mds/CDir.cc | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 4fec6b6e17a..249215519ff 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -1765,10 +1765,8 @@ void CDir::auth_pin(void *by) << " count now " << auth_pins << " + " << nested_auth_pins << dendl; // nest pins? - if (is_subtree_root()) return; // no. - //assert(!is_import()); - - if (get_cum_auth_pins() == 1) + if (!is_subtree_root() && + get_cum_auth_pins() == 1) inode->adjust_nested_auth_pins(1); } @@ -1788,13 +1786,13 @@ void CDir::auth_unpin(void *by) << " count now " << auth_pins << " + " << nested_auth_pins << dendl; assert(auth_pins >= 0); + int newcum = get_cum_auth_pins(); + maybe_finish_freeze(); // pending freeze? // nest? - if (is_subtree_root()) return; // no. - //assert(!is_import()); - - if (get_cum_auth_pins() == 0) + if (!is_subtree_root() && + newcum == 0) inode->adjust_nested_auth_pins(-1); } @@ -1808,17 +1806,17 @@ void CDir::adjust_nested_auth_pins(int inc, int dirinc) assert(nested_auth_pins >= 0); assert(dir_auth_pins >= 0); + int newcum = get_cum_auth_pins(); + maybe_finish_freeze(); // pending freeze? - // adjust my inode? - if (is_subtree_root()) - return; // no, stop. - - // yes. - if (get_cum_auth_pins() == 0) - inode->adjust_nested_auth_pins(-1); - else if (get_cum_auth_pins() == inc) - inode->adjust_nested_auth_pins(1); + // nest? + if (!is_subtree_root()) { + if (newcum == 0) + inode->adjust_nested_auth_pins(-1); + else if (newcum == inc) + inode->adjust_nested_auth_pins(1); + } } void CDir::adjust_nested_anchors(int by)