]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: cleanup truncating inodes when standby replay mds trim log segments 29232/head
authorYan, Zheng <zyan@redhat.com>
Fri, 21 Jun 2019 08:24:51 +0000 (16:24 +0800)
committerNathan Cutler <ncutler@suse.com>
Sat, 7 Sep 2019 09:30:17 +0000 (11:30 +0200)
Standby replay mds first trims expired log segments, then replays new
log segments. It's possible a 'truncate_start' log event is in expired,
but its 'truncate_finish' counterpart is the new log segments. When mds
replays the 'truncate_finish' log event, log segment that contains the
'truncate_start' is already trimmed, so mds does nothing. This causes
leak of Inode::PIN_TRUNCATING and trigger assertion when removing
corresponding inode.

Fixes: https://tracker.ceph.com/issues/40477
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 32121878dd0eef11e481162ebf924a14a91dd341)

src/mds/MDCache.cc

index 18fa35ae6b72d6384d854ae1e9d46546a5e753ef..b903a039d5cee721cff265d97bce6f7cf25ad4d0 100644 (file)
@@ -7383,6 +7383,13 @@ void MDCache::standby_trim_segment(LogSegment *ls)
     in->dirfragtreelock.remove_dirty();
     try_trim_inode(in);
   }
+  while (!ls->truncating_inodes.empty()) {
+    auto it = ls->truncating_inodes.begin();
+    CInode *in = *it;
+    ls->truncating_inodes.erase(it);
+    in->put(CInode::PIN_TRUNCATING);
+    try_trim_inode(in);
+  }
 }
 
 /* This function DOES put the passed message before returning */