]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: truncate sanity checks
authorSage Weil <sage@newdream.net>
Thu, 1 Sep 2011 20:01:06 +0000 (13:01 -0700)
committerSage Weil <sage@newdream.net>
Thu, 1 Sep 2011 20:15:21 +0000 (13:15 -0700)
Hunting #1472.

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

index aa306adfcb868d27b2aa813f3d045ea0fb91f3fe..528d1f8b9708f210d96bc90751ebda628a1c8b89 100644 (file)
@@ -129,6 +129,10 @@ ostream& operator<<(ostream& out, CInode& in)
   if (in.is_freezing_inode()) out << " FREEZING=" << in.auth_pin_freeze_allowance;
   if (in.is_frozen_inode()) out << " FROZEN";
 
+  inode_t *pi = in.get_projected_inode();
+  if (pi->is_truncating())
+    out << " truncating(" << pi->truncate_from << " to " << pi->truncate_size << ")";
+
   // anchors
   if (in.is_anchored())
     out << " anc";
index e07479e2fe48bd9acd82c7224fa7aaf567bf1129..5422f5b4992f45fb92b6ddb0cce75935a0eda117 100644 (file)
@@ -5232,6 +5232,8 @@ void MDCache::_truncate_inode(CInode *in, LogSegment *ls)
           << pi->truncate_from << " -> " << pi->truncate_size
           << " on " << *in << dendl;
 
+  assert(pi->is_truncating());
+
   in->auth_pin(this);
 
   SnapRealm *realm = in->find_snaprealm();
index 70f029740d04bc94d7c69dde41fde953626fe505..32f597277a175d91285f34357d0171c55329f710 100644 (file)
@@ -430,6 +430,7 @@ struct inode_t {
 
   bool is_truncating() const { return (truncate_pending > 0); }
   void truncate(uint64_t old_size, uint64_t new_size) {
+    assert(new_size < old_size);
     truncate_from = old_size;
     size = new_size;
     rstat.rbytes = new_size;