[PATCH 08/14] mds: re-issue caps after importing caps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Yan, Zheng" <zheng.z.yan@xxxxxxxxx>

The imported caps may prevent unstable locks from entering stable
states. So we should call Locker::eval_gather() with parameter
"first" set to true after caps are imported.

Signed-off-by: Yan, Zheng <zheng.z.yan@xxxxxxxxx>
---
 src/mds/Locker.cc   | 16 ++++++++--------
 src/mds/Locker.h    |  6 +++---
 src/mds/Migrator.cc |  3 ++-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc
index a8ec19f..860577f 100644
--- a/src/mds/Locker.cc
+++ b/src/mds/Locker.cc
@@ -769,7 +769,7 @@ void Locker::eval_gather(SimpleLock *lock, bool first, bool *pneed_issue, list<C
 
 }
 
-bool Locker::eval(CInode *in, int mask)
+bool Locker::eval(CInode *in, int mask, bool caps_imported)
 {
   bool need_issue = false;
   
@@ -790,19 +790,19 @@ bool Locker::eval(CInode *in, int mask)
 
  retry:
   if (mask & CEPH_LOCK_IFILE)
-    eval_any(&in->filelock, &need_issue);
+    eval_any(&in->filelock, &need_issue, caps_imported);
   if (mask & CEPH_LOCK_IAUTH)
-    eval_any(&in->authlock, &need_issue);
+    eval_any(&in->authlock, &need_issue, caps_imported);
   if (mask & CEPH_LOCK_ILINK)
-    eval_any(&in->linklock, &need_issue);
+    eval_any(&in->linklock, &need_issue,caps_imported);
   if (mask & CEPH_LOCK_IXATTR)
-    eval_any(&in->xattrlock, &need_issue);
+    eval_any(&in->xattrlock, &need_issue, caps_imported);
   if (mask & CEPH_LOCK_INEST)
-    eval_any(&in->nestlock, &need_issue);
+    eval_any(&in->nestlock, &need_issue, caps_imported);
   if (mask & CEPH_LOCK_IFLOCK)
-    eval_any(&in->flocklock, &need_issue);
+    eval_any(&in->flocklock, &need_issue, caps_imported);
   if (mask & CEPH_LOCK_IPOLICY)
-    eval_any(&in->policylock, &need_issue);
+    eval_any(&in->policylock, &need_issue, caps_imported);
 
   // drop loner?
   if (in->is_auth() && in->is_head() && in->get_wanted_loner() != in->get_loner()) {
diff --git a/src/mds/Locker.h b/src/mds/Locker.h
index b3b9919..04a5252 100644
--- a/src/mds/Locker.h
+++ b/src/mds/Locker.h
@@ -99,9 +99,9 @@ public:
 
   void eval_gather(SimpleLock *lock, bool first=false, bool *need_issue=0, list<Context*> *pfinishers=0);
   void eval(SimpleLock *lock, bool *need_issue);
-  void eval_any(SimpleLock *lock, bool *need_issue) {
+  void eval_any(SimpleLock *lock, bool *need_issue, bool first=false) {
     if (!lock->is_stable())
-      eval_gather(lock, false, need_issue);
+      eval_gather(lock, first, need_issue);
     else if (lock->get_parent()->is_auth())
       eval(lock, need_issue);
   }
@@ -122,7 +122,7 @@ public:
 
   void eval_cap_gather(CInode *in, set<CInode*> *issue_set=0);
 
-  bool eval(CInode *in, int mask);
+  bool eval(CInode *in, int mask, bool caps_imported=false);
   void try_eval(MDSCacheObject *p, int mask);
   void try_eval(SimpleLock *lock, bool *pneed_issue);
 
diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc
index cc045b4..c157279 100644
--- a/src/mds/Migrator.cc
+++ b/src/mds/Migrator.cc
@@ -2230,7 +2230,7 @@ void Migrator::import_finish(CDir *dir)
        p != cap_imports.end();
        p++)
     if (p->first->is_auth())
-      mds->locker->eval(p->first, CEPH_CAP_LOCKS);
+      mds->locker->eval(p->first, CEPH_CAP_LOCKS, true);
 
   // send pending import_maps?
   mds->mdcache->maybe_send_pending_resolves();
@@ -2614,6 +2614,7 @@ void Migrator::logged_import_caps(CInode *in,
 
   assert(cap_imports.count(in));
   finish_import_inode_caps(in, from, cap_imports[in]);  
+  mds->locker->eval(in, CEPH_CAP_LOCKS, true);
 
   mds->send_message_mds(new MExportCapsAck(in->ino()), from);
 }
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux