]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: error to log when inode/dirfrag rbytes get out of sync
authorSage Weil <sage@newdream.net>
Thu, 23 Sep 2010 23:20:00 +0000 (16:20 -0700)
committerSage Weil <sage@newdream.net>
Fri, 24 Sep 2010 18:44:22 +0000 (11:44 -0700)
Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/CInode.cc

index 572fbf31b22455fa46ad069f4f172b5a6eef7a2a..1a85fc3f7a77034477b4830cb34de5067b391475 100644 (file)
@@ -1487,6 +1487,20 @@ void CInode::finish_scatter_gather_update(int type)
        }
        dir->dirty_old_rstat.clear();
        pf->rstat.version = pf->accounted_rstat.version = pi->rstat.version + 1;
+
+       if (fg == 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 " << dir->dirfrag()
+              << ", inode has " << pi->rstat << ", dirfrag has " << pf->rstat;
+           mdcache->mds->logclient.log(LOG_ERROR, ss);
+
+           // trust the dirfrag for now
+           pi->rstat = pf->rstat;
+           pi->rstat.version--;  // (about to re-increment it below!)
+           assert("unmatched rstat rbytes" == 0);
+         }
+       }
       }
       pi->rstat.version++;
       dout(20) << " final rstat " << pi->rstat << dendl;