From 6cb1f6cca7d9014d974e27cfd32876d490ded3bb Mon Sep 17 00:00:00 2001 From: John Spray Date: Thu, 30 Apr 2015 17:44:23 +0100 Subject: [PATCH] mds: handle missing/corrupt data during boot These errors trickle up to boot_start from e.g. CInode::_fetched when something goes wrong. Signed-off-by: John Spray --- src/mds/MDS.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc index 5aea27d9c31..be3d39bc19f 100644 --- a/src/mds/MDS.cc +++ b/src/mds/MDS.cc @@ -1939,7 +1939,14 @@ void MDS::boot_start(BootStep step, int r) dout(0) << "boot_start encountered an error EAGAIN" << ", respawning since we fell behind journal" << dendl; respawn(); + } else if (r == -EINVAL || r == -ENOENT) { + // Invalid or absent data, indicates damaged on-disk structures + clog->error() << "Error loading MDS rank " << whoami << ": " + << cpp_strerror(r); + damaged(); + assert(r == 0); // Unreachable, damaged() calls respawn() } else { + // Completely unexpected error, give up and die dout(0) << "boot_start encountered an error, failing" << dendl; suicide(); return;