]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't pin inodes in MDCache::export_pin_queue 15106/head
authorYan, Zheng <zyan@redhat.com>
Wed, 17 May 2017 08:08:32 +0000 (16:08 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 17 May 2017 08:14:21 +0000 (16:14 +0800)
pinning inode can trigger assertion when replaying log

 1: (()+0x560ceb) [0x55b263ff7ceb]
 2: (()+0x115c0) [0x7fc0393a75c0]
 3: (gsignal()+0x9f) [0x7fc03812f91f]
 4: (abort()+0x16a) [0x7fc03813151a]
 5: (ceph::__ceph_assert_fail(char const*, char const*, int, char const*)+0x2bc) [0x55b26404158c]
 6: (MDCache::remove_inode(CInode*)+0x316) [0x55b263d9c616]
 7: (MDCache::trim_non_auth_subtree(CDir*)+0x4d8) [0x55b263d9cd68]
 8: (MDCache::try_trim_non_auth_subtree(CDir*)+0x5e2) [0x55b263da7292]
 9: (EExport::replay(MDSRank*)+0x549) [0x55b263fdc619]
 10: (MDLog::_replay_thread()+0xd0f) [0x55b263f8580f]
 11: (MDLog::ReplayThread::entry()+0xd) [0x55b263cebbfd]
 12: (()+0x76ca) [0x7fc03939d6ca]
 13: (clone()+0x5f) [0x7fc038201f7f]

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/CInode.cc
src/mds/CInode.h
src/mds/MDBalancer.cc
src/mds/MDCache.cc

index ba2ebaab60a85697b1c6baf4a559cfbca7bdac2d..fdc264328f863c5bc214f45a18e97c72eb0c7950 100644 (file)
@@ -4419,7 +4419,7 @@ void CInode::maybe_export_pin(bool update)
   if (export_pin == MDS_RANK_NONE && !update)
     return;
 
-  if (mdcache->export_pin_queue.count(this))
+  if (state_test(CInode::STATE_QUEUEDEXPORTPIN))
     return;
 
   bool queue = false;
@@ -4440,7 +4440,7 @@ void CInode::maybe_export_pin(bool update)
       queue = dir->state_test(CDir::STATE_AUXSUBTREE);
     }
     if (queue) {
-      get(CInode::PIN_EXPORTPINQUEUE);
+      state_set(CInode::STATE_QUEUEDEXPORTPIN);
       mdcache->export_pin_queue.insert(this);
       break;
     }
index 0eb72690cc2b3d6ac4dc4164fc191429f5c2a672..a446bebb8cf31e28df4d325de18e8ac7f43558b8 100644 (file)
@@ -153,7 +153,6 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
   static const int PIN_DIRTYPARENT =      23;
   static const int PIN_DIRWAITER =        24;
   static const int PIN_SCRUBQUEUE =       25;
-  static const int PIN_EXPORTPINQUEUE =   26;
 
   const char *pin_name(int p) const override {
     switch (p) {
@@ -179,7 +178,6 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
     case PIN_DIRTYPARENT: return "dirtyparent";
     case PIN_DIRWAITER: return "dirwaiter";
     case PIN_SCRUBQUEUE: return "scrubqueue";
-    case PIN_EXPORTPINQUEUE: return "exportpinqueue";
     default: return generic_pin_name(p);
     }
   }
@@ -202,6 +200,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
   static const int STATE_REPAIRSTATS = (1<<19);
   static const int STATE_MISSINGOBJS = (1<<20);
   static const int STATE_EVALSTALECAPS = (1<<21);
+  static const int STATE_QUEUEDEXPORTPIN = (1<<22);
   // orphan inode needs notification of releasing reference
   static const int STATE_ORPHAN =      STATE_NOTIFYREF;
 
index bb9841a70b80c2dea9dda8b58c94f651207d84fa..17a055154aa2a65bf6ba378411ff2cab9cd95062 100644 (file)
@@ -125,8 +125,8 @@ void MDBalancer::handle_export_pins(void)
     }
 
     if (remove) {
+      in->state_clear(CInode::STATE_QUEUEDEXPORTPIN);
       q.erase(cur);
-      in->put(CInode::PIN_EXPORTPINQUEUE);
     }
   }
 
index ae1c7e250e4b287deb3e905064965652fa862b5b..4b56cb879b63298cdaa1a1098acba29f3f06fb5e 100644 (file)
@@ -295,6 +295,9 @@ void MDCache::remove_inode(CInode *o)
 
   o->item_open_file.remove_myself();
 
+  if (o->state_test(CInode::STATE_QUEUEDEXPORTPIN))
+    export_pin_queue.erase(o);
+
   // remove from inode map
   inode_map.erase(o->vino());