mds: fix stray migration/reintegration check in handle_client_rename
PATCH 1/4 mds: fix stray migration/reintegration check in handle_client_rename
From: "Yan, Zheng" <[email protected]>
The stray migration/reintegration generates a source path that will be rooted in a (possibly remote) MDS's MDSDIR; adjust the check in handle_client_rename()
--- src/leveldb | 2 +- src/mds/Server.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
src/leveldb +1 -1
@@ -1 +1 @@ -Subproject commit c79c270174307411819ddfdd8c9b671ec4fb69c9 +Subproject commit f2d406b4213a22bfed3acfdb071fbec9ca9205cc
src/mds/Server.cc +1 -1
@@ -5135,7 +5135,7 @@ void Server::handle_client_rename(MDRequest *mdr) // is this a stray migration, reintegration or merge? (sanity checks!) if (mdr->reqid.name.is_mds() && - !(MDS_INO_IS_STRAY(srcpath.get_ino()) && + !(MDS_INO_IS_MDSDIR(srcpath.get_ino()) && MDS_INO_IS_STRAY(destpath.get_ino())) && !(destdnl->is_remote() && destdnl->get_remote_ino() == srci->ino())) {
Signature · 1 line
1.7.11.7
PATCH 2/4 mds: Fix stray check in Migrator::export_dir()
From: "Yan, Zheng" <[email protected]>
Commit f8110c (Allow export subtrees in other MDS' stray directory) make the "directory in stray " check always return false. This is because the directory in question is grandchild of mdsdir.
--- src/mds/Migrator.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
src/mds/Migrator.cc +2 -2
@@ -640,8 +640,8 @@ void Migrator::export_dir(CDir *dir, int dest) return; } - if (!dir->inode->is_base() && - dir->inode->get_parent_dir()->ino() == MDS_INO_MDSDIR(mds->get_nodeid())) { + if (!dir->inode->is_base() && dir->get_parent_dir()->get_inode()->is_stray() && + dir->get_parent_dir()->get_parent_dir()->ino() == MDS_INO_MDSDIR(mds->get_nodeid())) { dout(7) << "i won't export anything in stray" << dendl; return; }
Signature · 1 line
1.7.11.7
PATCH 3/4 mds: Send mdsdir as base inode for rejoins
In reply to Yan, ZhengFrom: "Yan, Zheng" <[email protected]>
Stray dir inodes are no longer base inodes, they are in the mdsdir and the mdrdir is base inode.
--- src/mds/MDCache.cc | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
src/mds/MDCache.cc +11 -13
@@ -3315,10 +3315,9 @@ void MDCache::rejoin_send_rejoins() p->second->add_scatterlock_state(root); } } - for (int i = 0; i < NUM_STRAY; ++i) { - CInode *s = get_inode(MDS_INO_STRAY(p->first, i)); - if (s) - p->second->add_weak_inode(s->vino()); + if (CInode *in = get_inode(MDS_INO_MDSDIR(p->first))) { + if (in) + p->second->add_weak_inode(in->vino()); } } else { // strong
@@ -3334,15 +3333,14 @@ void MDCache::rejoin_send_rejoins() p->second->add_scatterlock_state(root); } } - for (int i = 0; i < NUM_STRAY; ++i) { - if (CInode *in = get_inode(MDS_INO_STRAY(p->first, i))) { - p->second->add_weak_inode(in->vino()); - p->second->add_strong_inode(in->vino(), - in->get_caps_wanted(), - in->filelock.get_state(), - in->nestlock.get_state(), - in->dirfragtreelock.get_state()); - } + + if (CInode *in = get_inode(MDS_INO_MDSDIR(p->first))) { + p->second->add_weak_inode(in->vino()); + p->second->add_strong_inode(in->vino(), + in->get_caps_wanted(), + in->filelock.get_state(), + in->nestlock.get_state(), + in->dirfragtreelock.get_state()); } } }
Signature · 1 line
1.7.11.7
PATCH 4/4 mds: Allow evaluating locks in replica object.
In reply to Yan, ZhengFrom: "Yan, Zheng" <[email protected]>
We should allow Locker::try_eval(MDSCacheObject *, int) to evaluate locks in replica objects. Otherwise the locks in replica objects may stuck on unstable states forever.
--- src/mds/Locker.cc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
src/mds/Locker.cc +6 -9
@@ -834,12 +834,7 @@ void Locker::try_eval(MDSCacheObject *p, int mask) return; } - if (!p->is_auth()) { - dout(7) << "try_eval not auth for " << *p << dendl; - return; - } - - if (!p->can_auth_pin()) { + if (p->is_auth() && !p->can_auth_pin()) { dout(7) << "try_eval can't auth_pin, waiting on " << *p << dendl; p->add_waiter(MDSCacheObject::WAIT_UNFREEZE, new C_Locker_Eval(this, p, mask)); return;
@@ -847,9 +842,11 @@ void Locker::try_eval(MDSCacheObject *p, int mask) if (mask & CEPH_LOCK_DN) { assert(mask == CEPH_LOCK_DN); - bool need_issue = false; // ignore this, no caps on dentries - CDentry *dn = (CDentry *)p; - simple_eval(&dn->lock, &need_issue); + if (p->is_auth()) { + bool need_issue = false; // ignore this, no caps on dentries + CDentry *dn = (CDentry *)p; + simple_eval(&dn->lock, &need_issue); + } } else { CInode *in = (CInode *)p; eval(in, mask);
Signature · 1 line
1.7.11.7
Re: [PATCH 4/4] mds: Allow evaluating locks in replica object.
Hi Yan,
Quoted 46 lines · Zheng
From: "Yan, Zheng" <[email protected]>
We should allow
Locker::try_eval(MDSCacheObject *, int)to evaluate locks in replica objects. Otherwise the locks in replica objects may stuck on unstable states forever.Signed-off-by Yan, Zheng <[email protected]>--- src/mds/Locker.cc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)src/mds/Locker.cc +6
-9@@ -834,12 +834,7 @@ void Locker::try_eval(MDSCacheObject *p, int mask) return; } - if (!p->is_auth()) { - dout(7) << "try_eval not auth for " << *p << dendl; - return; - } - - if (!p->can_auth_pin()) { + if (p->is_auth() && !p->can_auth_pin()) { dout(7) << "try_eval can't auth_pin, waiting on " << *p << dendl; p->add_waiter(MDSCacheObject::WAIT_UNFREEZE, new C_Locker_Eval(this, p, mask)); return;@@ -847,9 +842,11 @@ void Locker::try_eval(MDSCacheObject *p, int mask) if (mask & CEPH_LOCK_DN) { assert(mask == CEPH_LOCK_DN); - bool need_issue = false; // ignore this, no caps on dentries - CDentry *dn = (CDentry *)p; - simple_eval(&dn->lock, &need_issue); + if (p->is_auth()) { + bool need_issue = false; // ignore this, no caps on dentries + CDentry *dn = (CDentry *)p; + simple_eval(&dn->lock, &need_issue); + } } else { CInode *in = (CInode *)p; eval(in, mask);Signature · 1 line
1.7.11.7
I handled this one a bit differently. I think we should still consider the non-auth eval_gather() case on the dentry. I applied the below to the wip-mds branch.. look okay? Notably, eval(CInode*,...) calls eval_any() on all of the masked locks, so the path is symmetrical.
Thanks!
sage
src/mds/Locker.cc +2 -7
@@ -834,12 +834,7 @@ void Locker::try_eval(MDSCacheObject *p, int mask) return; } - if (!p->is_auth()) { - dout(7) << "try_eval not auth for " << *p << dendl; - return; - } - - if (!p->can_auth_pin()) { + if (p->is_auth() && !p->can_auth_pin()) { dout(7) << "try_eval can't auth_pin, waiting on " << *p << dendl; p->add_waiter(MDSCacheObject::WAIT_UNFREEZE, new C_Locker_Eval(this, p, mask)); return;
@@ -849,7 +844,7 @@ void Locker::try_eval(MDSCacheObject *p, int mask) assert(mask == CEPH_LOCK_DN); bool need_issue = false; // ignore this, no caps on dentries CDentry *dn = (CDentry *)p; - simple_eval(&dn->lock, &need_issue); + eval_any(&dn->lock, &need_issue); } else { CInode *in = (CInode *)p; eval(in, mask);