Merge PR #21040 into master

* refs/pull/21040/head:
	mds: mark damaged if sessions' preallocated inos don't match inotable

Reviewed-by: John Spray <john.spray@redhat.com>
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Patrick Donnelly 2018-04-09 21:33:10 -07:00
commit 098c6d370f
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB

View File

@ -1144,7 +1144,7 @@ void MDSRank::boot_start(BootStep step, int r)
void MDSRank::validate_sessions()
{
assert(mds_lock.is_locked_by_me());
std::vector<Session*> victims;
bool valid = true;
// Identify any sessions which have state inconsistent with other,
// after they have been loaded from rados during startup.
@ -1154,19 +1154,15 @@ void MDSRank::validate_sessions()
Session *session = i.second;
interval_set<inodeno_t> 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);
}
}