]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: remove pruned parent snaprealm from snaprealm's open_past_parents
authorYan, Zheng <zyan@redhat.com>
Mon, 1 Jun 2015 06:08:04 +0000 (14:08 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 1 Jun 2015 06:09:22 +0000 (14:09 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/SnapRealm.cc
src/mds/SnapRealm.h

index 35a0f757a14f5613868edaefe895466b062c74d5..5b4bc21f2465c3f345bb10533eb62502f5560fb6 100644 (file)
@@ -65,6 +65,16 @@ void SnapRealm::add_open_past_parent(SnapRealm *parent)
   parent->inode->get(CInode::PIN_PASTSNAPPARENT);
 }
 
+void SnapRealm::remove_open_past_parent(inodeno_t ino)
+{
+  map<inodeno_t,SnapRealm*>::iterator p = open_past_parents.find(ino);
+  assert(p != open_past_parents.end());
+  SnapRealm *parent = p->second;
+  open_past_parents.erase(p);
+  parent->open_past_children.erase(this);
+  parent->inode->put(CInode::PIN_PASTSNAPPARENT);
+}
+
 struct C_SR_RetryOpenParents : public MDSInternalContextBase {
   SnapRealm *sr;
   snapid_t first, last, parent_last;
@@ -518,6 +528,7 @@ void SnapRealm::prune_past_parents()
        *q > p->first) {
       dout(10) << "prune_past_parents pruning [" << p->second.first << "," << p->first 
               << "] " << p->second.ino << dendl;
+      remove_open_past_parent(p->second.ino);
       srnode.past_parents.erase(p++);
     } else {
       dout(10) << "prune_past_parents keeping [" << p->second.first << "," << p->first 
index ad55adc017237797228395f176882e46d8a398eb..feffea19be3556017c4904cdb3fe590fadb7ea05 100644 (file)
@@ -76,6 +76,7 @@ struct SnapRealm {
   }
   bool have_past_parents_open(snapid_t first=1, snapid_t last=CEPH_NOSNAP);
   void add_open_past_parent(SnapRealm *parent);
+  void remove_open_past_parent(inodeno_t ino);
   void close_parents();
 
   void prune_past_parents();