From 0f9703ee4682985aaa6e5536b972073a2a5e0834 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Mon, 26 Mar 2018 15:55:02 +0800 Subject: [PATCH] mds: mark damaged if sessions' preallocated inos don't match inotable We don't know if session's preallocated inos are incorrect or inotable is incorrect. So it's better just mark mds damaged. Fixes: http://tracker.ceph.com/issues/23452 Signed-off-by: "Yan, Zheng" (cherry picked from commit e5832658d8654bdf11fcb3357b84e3853fd86031) --- src/mds/MDSRank.cc | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index de0a7c3e60af0..5791b845efecf 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -1140,7 +1140,7 @@ void MDSRank::boot_start(BootStep step, int r) void MDSRank::validate_sessions() { assert(mds_lock.is_locked_by_me()); - std::vector victims; + bool valid = true; // Identify any sessions which have state inconsistent with other, // after they have been loaded from rados during startup. @@ -1150,19 +1150,15 @@ void MDSRank::validate_sessions() Session *session = i.second; interval_set badones; if (inotable->intersects_free(session->info.prealloc_inos, &badones)) { - clog->error() << "Client session loaded with invalid preallocated " - "inodes, evicting session " << *session; - - // Make the session consistent with inotable so that it can - // be cleanly torn down - session->info.prealloc_inos.subtract(badones); - - victims.push_back(session); + clog->error() << "client " << *session + << "loaded with preallocated inodes that are inconsistent with inotable"; + valid = false; } } - for (const auto &session: victims) { - server->kill_session(session, nullptr); + if (!valid) { + damaged(); + assert(valid); } } -- 2.39.5