diff options
author | Sage Weil <sage@newdream.net> | 2011-09-01 13:01:06 -0700 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2011-09-01 13:15:21 -0700 |
commit | b2c762beccf8ca260e3d2ad25ee9b7c62eeedbbb (patch) | |
tree | accff000118607a12a78d8dd5ef48d65e06f3f0a | |
parent | 4fa62d5e02ca0c065ab9fedeeb7311de4d989324 (diff) | |
download | ceph-b2c762beccf8ca260e3d2ad25ee9b7c62eeedbbb.tar.gz |
mds: truncate sanity checks
Hunting #1472.
Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r-- | src/mds/CInode.cc | 4 | ||||
-rw-r--r-- | src/mds/MDCache.cc | 2 | ||||
-rw-r--r-- | src/mds/mdstypes.h | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index aa306adfcb8..528d1f8b970 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -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"; diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index e07479e2fe4..5422f5b4992 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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(); diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index 70f029740d0..32f597277a1 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -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; |