From 1a4557e858908541078bd6fdd99324209f95e9bd Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 12 Nov 2009 10:45:54 -0800 Subject: [PATCH] mds: warn, don't crash, on rfiles/rsubdirs underflow This doesn't fix the bug, but lets the mds at least start up. --- src/mds/CInode.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index cd9fb7004137f..1a13310ab3873 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -1230,8 +1230,22 @@ void CInode::finish_scatter_gather_update(int type) } pi->rstat.version++; dout(20) << " final rstat " << pi->rstat << dendl; - assert(pi->rstat.rfiles >= 0); - assert(pi->rstat.rsubdirs >= 0); + + //assert(pi->rstat.rfiles >= 0); + if (pi->rstat.rfiles < 0) { + stringstream ss; + ss << "rfiles underflow " << pi->rstat.rfiles << " on " << *this; + mdcache->mds->logclient.log(LOG_ERROR, ss); + pi->rstat.rfiles = 0; + } + + //assert(pi->rstat.rsubdirs >= 0); + if (pi->rstat.rsubdirs < 0) { + stringstream ss; + ss << "rsubdirs underflow " << pi->rstat.rfiles << " on " << *this; + mdcache->mds->logclient.log(LOG_ERROR, ss); + pi->rstat.rsubdirs = 0; + } } break; -- 2.39.5