]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix steal_dentry dir_auth_pins adjustment
authorSage Weil <sage@newdream.net>
Thu, 28 Apr 2011 20:22:30 +0000 (13:22 -0700)
committerSage Weil <sage@newdream.net>
Thu, 28 Apr 2011 20:22:30 +0000 (13:22 -0700)
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>
src/mds/CDentry.cc
src/mds/CDentry.h
src/mds/CDir.cc

index b7dbbc605007828a9f45252727a2ee85abf58659..2e0b40bcc6389ab53891bbc99cf72dd3e5aea750 100644 (file)
@@ -346,6 +346,14 @@ CDentry::linkage_t *CDentry::pop_projected_linkage()
 // ----------------------------
 // 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);
index ac7115c8553efc1e41f07e7cfcc61c1c122ed7a9..7046edfc15e84c704e5794b0e20e0888c4f78fcb 100644 (file)
@@ -263,6 +263,7 @@ public:
   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);
index ece3404024b54fc78147e7a0b86ce5f246aff5a7..efa4962b0eba4a2bd89a806b41282cbe70d4aa26 100644 (file)
@@ -732,8 +732,11 @@ void CDir::steal_dentry(CDentry *dn)
 
   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;