From e10840ba9ceb9bfae6130d76a93ced2b889fc03f Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Wed, 31 Jul 2019 10:43:35 +0800 Subject: [PATCH] mds: fix InoTable::force_consume_to() original code assumes free inode numbers are contiguous Fixes: https://tracker.ceph.com/issues/41006 Signed-off-by: "Yan, Zheng" --- src/mds/InoTable.cc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/mds/InoTable.cc b/src/mds/InoTable.cc index caa1bfc453102..fb0ec29724164 100644 --- a/src/mds/InoTable.cc +++ b/src/mds/InoTable.cc @@ -226,15 +226,10 @@ bool InoTable::repair(inodeno_t id) bool InoTable::force_consume_to(inodeno_t ino) { - auto it = free.begin(); - if (it != free.end() && it.get_start() <= ino) { - inodeno_t min = it.get_start(); - derr << "erasing " << min << " to " << ino << dendl; - free.erase(min, ino - min + 1); - projected_free = free; - projected_version = ++version; - return true; - } else { + inodeno_t first = free.range_start(); + if (first > ino) return false; - } + + skip_inos(inodeno_t(ino + 1 - first)); + return true; } -- 2.39.5