Skip to content

Commit

Permalink
mds: fix use-after-free in MDCache::disambiguate_imports
Browse files Browse the repository at this point in the history
MDCache::try_trim_non_auth_subtree() frees the CDir

Signed-off-by: Yan, Zheng <zyan@redhat.com>
  • Loading branch information
ukernel committed Jan 18, 2017
1 parent 7523278 commit e0d8548
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mds/MDCache.cc
Expand Up @@ -3513,15 +3513,15 @@ void MDCache::disambiguate_imports()
dout(10) << "ambiguous import auth known, must not be me " << *dir << dendl;
cancel_ambiguous_import(dir);

mds->mdlog->start_submit_entry(new EImportFinish(dir, false));

// subtree may have been swallowed by another node claiming dir
// as their own.
CDir *root = get_subtree_root(dir);
if (root != dir)
dout(10) << " subtree root is " << *root << dendl;
assert(root->dir_auth.first != mds->get_nodeid()); // no us!
try_trim_non_auth_subtree(root);

mds->mdlog->start_submit_entry(new EImportFinish(dir, false));
} else {
dout(10) << "ambiguous import auth unclaimed, must be me " << *dir << dendl;
finish_ambiguous_import(q->first);
Expand Down

0 comments on commit e0d8548

Please sign in to comment.