summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-11-20 21:42:04 -0800
committerSage Weil <sage@newdream.net>2009-11-20 21:42:04 -0800
commit1ee8308c74f991e7d20c633b3e3a9f1691884be8 (patch)
tree070f05fb381d6935361b119f54128619e122aeb2
parentb62daac29d15c4676f74c93a44e36cf125dbe829 (diff)
downloadceph-1ee8308c74f991e7d20c633b3e3a9f1691884be8.tar.gz
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.
-rw-r--r--src/mds/MDCache.cc13
-rw-r--r--src/mds/MDCache.h6
-rw-r--r--src/mds/Server.cc4
3 files changed, 12 insertions, 11 deletions
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc
index d7e21082a41..621bd637539 100644
--- a/src/mds/MDCache.cc
+++ b/src/mds/MDCache.cc
@@ -650,7 +650,7 @@ void MDCache::list_subtrees(list<CDir*>& 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<int,int> auth)
+void MDCache::adjust_subtree_auth(CDir *dir, pair<int,int> 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<int,int> 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 f858ca055e5..ee2842d88d2 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<CDir*>& ls);
- void adjust_subtree_auth(CDir *root, pair<int,int> auth);
- void adjust_subtree_auth(CDir *root, int a, int b=CDIR_AUTH_UNKNOWN) {
+ void adjust_subtree_auth(CDir *root, pair<int,int> 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<int,int>(a,b));
}
void adjust_bounded_subtree_auth(CDir *dir, set<CDir*>& bounds, pair<int,int> 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 d08f15fccff..4be67678203 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<CDir*>::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<CDir*>::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