]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: pin inode when openning snap parent
authorYan, Zheng <zyan@redhat.com>
Tue, 10 Mar 2015 03:11:15 +0000 (11:11 +0800)
committerYan, Zheng <zyan@redhat.com>
Fri, 13 Mar 2015 01:46:43 +0000 (09:46 +0800)
make sure SnapRealm not get freed before C_SR_RetryOpenParents
get executed.

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

index 627892421e2edb662b1add797649ad50203d6a66..080d44c7b5c3cc1bce80a25ff1381f1e31a032ca 100644 (file)
@@ -71,13 +71,16 @@ struct C_SR_RetryOpenParents : public MDSInternalContextBase {
   MDSInternalContextBase* fin;
   C_SR_RetryOpenParents(SnapRealm *s, snapid_t f, snapid_t l, snapid_t pl,
                        inodeno_t p, MDSInternalContextBase *c) :
-    sr(s), first(f), last(l), parent_last(pl),  parent(p), fin(c) {}
+    sr(s), first(f), last(l), parent_last(pl),  parent(p), fin(c) {
+    sr->inode->get(CInode::PIN_OPENINGSNAPPARENTS);
+  }
   MDS *get_mds() { return sr->mdcache->mds; }
   void finish(int r) {
     if (r < 0)
       sr->_remove_missing_parent(parent_last, parent, r);
     if (sr->_open_parents(fin, first, last))
       fin->complete(0);
+    sr->inode->put(CInode::PIN_OPENINGSNAPPARENTS);
   }
 };