From 9b5c7087919b5bfaf99e1ce745fc748baf1706cf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Piotr=20Da=C5=82ek?= Date: Thu, 21 Jan 2016 08:55:41 +0100 Subject: [PATCH] OSD/OSDService: make osdmap load error more human-understandable MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In case when OSD crashed leaving empty OSD maps in its store, subsequent OSD boots will fail with exception end_of_buffer thrown in map->decode. This occurs because _get_map_bl returns TRUE and empty bufferlist. In that case, inform user of actual issue instead of crashing in odd place and requiring them to strace ceph-osd to find out what actually happened. Signed-off-by: Piotr Dałek --- src/osd/OSD.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 7b864a52f776..715449520325 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1333,7 +1333,8 @@ OSDMapRef OSDService::try_get_map(epoch_t epoch) if (epoch > 0) { dout(20) << "get_map " << epoch << " - loading and decoding " << map << dendl; bufferlist bl; - if (!_get_map_bl(epoch, bl)) { + if (!_get_map_bl(epoch, bl) || bl.length() == 0) { + derr << "failed to load OSD map for epoch " << epoch << ", got " << bl.length() << " bytes" << dendl; delete map; return OSDMapRef(); } -- 2.47.3