From f23ba003d72fa6dd75e483135980874f6684e094 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 4 Nov 2010 13:04:47 -0700 Subject: [PATCH] mds: verify single frag rstat on projection too Currently we do a sanity check on gather; do the same check in project_rstat_frag_to_inode(). Signed-off-by: Sage Weil --- src/mds/MDCache.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 57ffb192d2857..8ba2dbad19660 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -1883,6 +1883,20 @@ void MDCache::predirty_journal_parents(Mutation *mut, EMetaBlob *blob, project_rstat_frag_to_inode(p->second.rstat, p->second.accounted_rstat, p->second.first, p->first, pin, true);//false); parent->dirty_old_rstat.clear(); project_rstat_frag_to_inode(pf->rstat, pf->accounted_rstat, parent->first, CEPH_NOSNAP, pin, true);//false); + + if (parent->get_frag() == frag_t()) { // i.e., we are the only frag + if (pi->rstat.rbytes != pf->rstat.rbytes) { + stringstream ss; + ss << "unmatched rstat rbytes on single dirfrag " << parent->dirfrag() + << ", inode has " << pi->rstat << ", dirfrag has " << pf->rstat; + mds->logclient.log(LOG_ERROR, ss); + + // trust the dirfrag for now + pi->rstat = pf->rstat; + + assert(!"unmatched rstat rbytes" == g_conf.mds_verify_scatter); + } + } // bump version pi->rstat.version++; -- 2.39.5