]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: verify single frag rstat on projection too
authorSage Weil <sage@newdream.net>
Thu, 4 Nov 2010 20:04:47 +0000 (13:04 -0700)
committerSage Weil <sage@newdream.net>
Thu, 4 Nov 2010 20:17:48 +0000 (13:17 -0700)
Currently we do a sanity check on gather; do the same check in
project_rstat_frag_to_inode().

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/MDCache.cc

index 57ffb192d285782261fcf4d9233d0ac2e9990473..8ba2dbad19660d1ef4df8bc83b190404908f6b62 100644 (file)
@@ -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++;