From: Sage Weil Date: Thu, 12 Mar 2009 18:57:26 +0000 (-0700) Subject: mds: only adjust inode auth_pins if we have cum auth pins X-Git-Tag: v0.7.1^2~47 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5425a65902a50f858767205f8d55835f18f96899;p=ceph.git mds: only adjust inode auth_pins if we have cum auth pins Add some assertions to that effect. --- diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 0d2ece723fb6..635c84bcc5fc 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -1708,7 +1708,8 @@ void CDir::set_dir_auth(pair a) dout(10) << " new subtree root, adjusting auth_pins" << dendl; // adjust nested auth pins - inode->adjust_nested_auth_pins(get_cum_auth_pins() ? -1:0); + if (get_cum_auth_pins()) + inode->adjust_nested_auth_pins(-1); // unpin parent of frozen dir/tree? if (inode->is_auth() && (is_frozen_tree_root() || is_frozen_dir())) @@ -1718,7 +1719,8 @@ void CDir::set_dir_auth(pair a) dout(10) << " old subtree root, adjusting auth_pins" << dendl; // adjust nested auth pins - inode->adjust_nested_auth_pins(get_cum_auth_pins() ? 1:0); + if (get_cum_auth_pins()) + inode->adjust_nested_auth_pins(1); // pin parent of frozen dir/tree? if (inode->is_auth() && (is_frozen_tree_root() || is_frozen_dir())) @@ -1798,6 +1800,7 @@ void CDir::auth_unpin(void *by) void CDir::adjust_nested_auth_pins(int inc, int dirinc) { + assert(inc); nested_auth_pins += inc; dir_auth_pins += dirinc; @@ -1821,6 +1824,7 @@ void CDir::adjust_nested_auth_pins(int inc, int dirinc) void CDir::adjust_nested_anchors(int by) { + assert(by); nested_anchors += by; dout(20) << "adjust_nested_anchors by " << by << " -> " << nested_anchors << dendl; assert(nested_anchors >= 0); diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index d848812a84dc..b239990ac4ea 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -1169,6 +1169,7 @@ void CInode::auth_unpin(void *by) void CInode::adjust_nested_auth_pins(int a) { + assert(a); nested_auth_pins += a; dout(35) << "adjust_nested_auth_pins by " << a << " now " << auth_pins << "+" << nested_auth_pins @@ -1181,6 +1182,7 @@ void CInode::adjust_nested_auth_pins(int a) void CInode::adjust_nested_anchors(int by) { + assert(by); nested_anchors += by; dout(20) << "adjust_nested_anchors by " << by << " -> " << nested_anchors << dendl; assert(nested_anchors >= 0);