]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: unlink any stale remote snap dentry when evaluating stray inode
authorYan, Zheng <zyan@redhat.com>
Mon, 18 May 2015 06:48:10 +0000 (14:48 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 19 May 2015 07:47:17 +0000 (15:47 +0800)
Remote snap dentry may hold reference to the stray directory inode,
the reference prevent the stray inode from being purged. After making
sure the stray directory inode is not referenced by any snapshot, we
know that all remote snap dentries should be stale, so we can unlink
them safely.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/StrayManager.cc

index 4ca33e8427e34d3f350d1f36d4a8d52e3ec0a042..d0334f5a3ba190fecf889b55686476f9b5d931d4 100644 (file)
@@ -573,6 +573,17 @@ bool StrayManager::eval_stray(CDentry *dn, bool delay)
           (*p)->try_remove_dentries_for_stray();
         }
       }
+
+      if (!in->remote_parents.empty()) {
+       // unlink any stale remote snap dentry.
+       for (compact_set<CDentry*>::iterator p = in->remote_parents.begin();
+            p != in->remote_parents.end(); ) {
+         CDentry *remote_dn = *p;
+         ++p;
+         assert(remote_dn->last != CEPH_NOSNAP);
+         remote_dn->unlink_remote(remote_dn->get_linkage());
+       }
+      }
     }
     if (dn->is_replicated()) {
       dout(20) << " replicated" << dendl;