From b815cf61c1d53bd0cd93186ec62842c8b122f279 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Tue, 10 Mar 2015 11:11:15 +0800 Subject: [PATCH] mds: pin inode when openning snap parent make sure SnapRealm not get freed before C_SR_RetryOpenParents get executed. Signed-off-by: Yan, Zheng --- src/mds/SnapRealm.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mds/SnapRealm.cc b/src/mds/SnapRealm.cc index 627892421e2..080d44c7b5c 100644 --- a/src/mds/SnapRealm.cc +++ b/src/mds/SnapRealm.cc @@ -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); } };