From 8b716c6db8f2b52f5da6dd0419934b84ab53b1ea Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Wed, 6 Oct 2010 16:35:14 -0700 Subject: [PATCH] mds: Check the lock state, not the inode state! This was causing a lot of slowdowns. Additionally, pin the inode when exporting caps -- otherwise it could disappear out from under a cap ack. This was probably just exposed by fixing the lock check. --- src/mds/CInode.h | 2 ++ src/mds/Locker.cc | 2 +- src/mds/Migrator.cc | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mds/CInode.h b/src/mds/CInode.h index c3f9c821ac217..5e8b6f7be751f 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -128,6 +128,7 @@ public: static const int PIN_STRAY = 19; // we pin our stray inode while active static const int PIN_NEEDSNAPFLUSH = 20; static const int PIN_DIRTYRSTAT = 21; + static const int PIN_EXPORTINGCAPS = 22; const char *pin_name(int p) { switch (p) { @@ -145,6 +146,7 @@ public: case PIN_FREEZING: return "freezing"; case PIN_FROZEN: return "frozen"; case PIN_IMPORTINGCAPS: return "importingcaps"; + case PIN_EXPORTINGCAPS: return "exportingcaps"; case PIN_PASTSNAPPARENT: return "pastsnapparent"; case PIN_OPENINGSNAPPARENTS: return "openingsnapparents"; case PIN_TRUNCATING: return "truncating"; diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 28130e61b4f90..0bad953ad514b 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -3654,7 +3654,7 @@ void Locker::file_eval(ScatterLock *lock, bool *need_issue) !lock->is_wrlocked() && // drain wrlocks first! !in->filelock.is_waiter_for(SimpleLock::WAIT_WR) && !(wanted & (CEPH_CAP_GWR|CEPH_CAP_GBUFFER)) && - !(in->get_state() == LOCK_MIX && + !(lock->get_state() == LOCK_MIX && in->is_dir() && in->has_subtree_root_dirfrag()) // if we are a delegation point, stay where we are //((wanted & CEPH_CAP_RD) || //in->is_replicated() || diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 7040e96b817a9..c6e3e8907efab 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -938,6 +938,7 @@ void Migrator::encode_export_inode_caps(CInode *in, bufferlist& bl, ::encode(cap_map, bl); in->state_set(CInode::STATE_EXPORTINGCAPS); + in->get(CInode::PIN_EXPORTINGCAPS); // make note of clients named by exported capabilities for (map::iterator it = in->client_caps.begin(); @@ -949,6 +950,7 @@ void Migrator::encode_export_inode_caps(CInode *in, bufferlist& bl, void Migrator::finish_export_inode_caps(CInode *in) { in->state_clear(CInode::STATE_EXPORTINGCAPS); + in->put(CInode::PIN_EXPORTINGCAPS); // tell (all) clients about migrating caps.. for (map::iterator it = in->client_caps.begin(); -- 2.39.5