From 1ee8308c74f991e7d20c633b3e3a9f1691884be8 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 20 Nov 2009 21:42:04 -0800 Subject: [PATCH] mds: do not eval subtree root during rename_prepare The eval may lead to a scatter_writebehind, which screws up the journal ordering. Since the inode is also locked, we will end up evaling it later anyway, so don't worry about it. I'm a bit unsure about the adjust_subtree_after_rename... that is during the rename_apply stage (after the log entry committed), so i think it's safe to do a scatter_writebehind here.. since we're not between a predirty and submit_entry. --- src/mds/MDCache.cc | 13 +++++++------ src/mds/MDCache.h | 6 +++--- src/mds/Server.cc | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index d7e21082a41d7..621bd6375390d 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -650,7 +650,7 @@ void MDCache::list_subtrees(list& ls) * merge with parent and/or child subtrees, if is it appropriate. * merge can ONLY happen if both parent and child have unambiguous auth. */ -void MDCache::adjust_subtree_auth(CDir *dir, pair auth) +void MDCache::adjust_subtree_auth(CDir *dir, pair auth, bool do_eval) { dout(7) << "adjust_subtree_auth " << dir->get_dir_auth() << " -> " << auth << " on " << *dir << dendl; @@ -714,7 +714,8 @@ void MDCache::adjust_subtree_auth(CDir *dir, pair auth) } } - eval_subtree_root(dir); + if (do_eval) + eval_subtree_root(dir->get_inode()); } show_subtrees(); @@ -787,7 +788,7 @@ void MDCache::try_subtree_merge_at(CDir *dir) } } - eval_subtree_root(dir); + eval_subtree_root(dir->get_inode()); // journal inode? // (this is a large hammer to ensure that dirfragtree updates will @@ -831,12 +832,12 @@ void MDCache::subtree_merge_writebehind_finish(CInode *in, Mutation *mut) in->auth_unpin(this); } -void MDCache::eval_subtree_root(CDir *dir) +void MDCache::eval_subtree_root(CInode *diri) { // evaluate subtree inode filelock? // (we should scatter the filelock on subtree bounds) - if (dir->inode->is_auth()) - mds->locker->try_eval(dir->inode, CEPH_LOCK_IFILE | CEPH_LOCK_INEST); + if (diri->is_auth()) + mds->locker->try_eval(diri, CEPH_LOCK_IFILE | CEPH_LOCK_INEST); } diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index f858ca055e5fa..ee2842d88d243 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -508,8 +508,8 @@ protected: public: bool is_subtrees() { return !subtrees.empty(); } void list_subtrees(list& ls); - void adjust_subtree_auth(CDir *root, pair auth); - void adjust_subtree_auth(CDir *root, int a, int b=CDIR_AUTH_UNKNOWN) { + void adjust_subtree_auth(CDir *root, pair auth, bool do_eval=true); + void adjust_subtree_auth(CDir *root, int a, int b=CDIR_AUTH_UNKNOWN, bool do_eval=true) { adjust_subtree_auth(root, pair(a,b)); } void adjust_bounded_subtree_auth(CDir *dir, set& bounds, pair auth); @@ -524,7 +524,7 @@ public: void try_subtree_merge(CDir *root); void try_subtree_merge_at(CDir *root); void subtree_merge_writebehind_finish(CInode *in, Mutation *mut); - void eval_subtree_root(CDir *dir); + void eval_subtree_root(CInode *diri); CDir *get_subtree_root(CDir *dir); bool is_leaf_subtree(CDir *dir) { assert(subtrees.count(dir)); diff --git a/src/mds/Server.cc b/src/mds/Server.cc index d08f15fccff4c..4be676782034e 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -4417,7 +4417,7 @@ void Server::_rename_prepare(MDRequest *mdr, srcdnl->get_inode()->get_nested_dirfrags(ls); int auth = srcdn->authority().first; for (list::iterator p = ls.begin(); p != ls.end(); ++p) - mdcache->adjust_subtree_auth(*p, auth, auth); + mdcache->adjust_subtree_auth(*p, auth, auth, false); } // do inode updates in journal, even if we aren't auth (hmm, is this necessary?) @@ -5052,7 +5052,7 @@ void Server::do_rename_rollback(bufferlist &rbl, int master, MDRequest *mdr) srcdnl->get_inode()->get_nested_dirfrags(ls); int auth = srcdn->authority().first; for (list::iterator p = ls.begin(); p != ls.end(); ++p) - mdcache->adjust_subtree_auth(*p, auth, auth); + mdcache->adjust_subtree_auth(*p, auth, auth, false); } // journal it -- 2.39.5