Pass down the correct value for dir_auth_pins (dh->auth_pins plus the
inode's auth_pins, but nothing nested beneath the inode). The CDentry
doesn't track dir auth pins independently, and doesn't really need to.
Signed-off-by: Sage Weil <sage@newdream.net>
// ----------------------------
// auth pins
+int CDentry::get_num_dir_auth_pins()
+{
+ assert(!is_projected());
+ if (get_linkage()->is_primary())
+ return auth_pins + get_linkage()->get_inode()->get_num_auth_pins();
+ return auth_pins;
+}
+
bool CDentry::can_auth_pin()
{
assert(dir);
bool is_frozen();
bool is_auth_pinned() { return auth_pins || nested_auth_pins; }
int get_num_auth_pins() { return auth_pins; }
+ int get_num_dir_auth_pins();
int get_num_nested_auth_pins() { return nested_auth_pins; }
void adjust_nested_anchors(int by);
if (dn->auth_pins || dn->nested_auth_pins) {
// use the helpers here to maintain the auth_pin invariants on the dir inode
- adjust_nested_auth_pins(dn->nested_auth_pins, dn->auth_pins);
- dn->dir->adjust_nested_auth_pins(-dn->nested_auth_pins, -dn->auth_pins);
+ int ap = dn->get_num_auth_pins() + dn->get_num_nested_auth_pins();
+ int dap = dn->get_num_dir_auth_pins();
+ assert(dap <= ap);
+ adjust_nested_auth_pins(ap, dap);
+ dn->dir->adjust_nested_auth_pins(-ap, -dap);
}
nested_anchors += dn->nested_anchors;