diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2013-10-11 14:03:13 +0800 |
---|---|---|
committer | Yan, Zheng <zheng.z.yan@intel.com> | 2013-10-11 14:26:47 +0800 |
commit | b9e2aab80707b22e617a4a0ec337d75f6ccefa8d (patch) | |
tree | 49f0f621a7035791450bc7af36d75bd5f0c56294 /src/mds/MDCache.cc | |
parent | cb9ebd6f363fb571ecb770eab9ab1313cb407108 (diff) | |
download | ceph-wip-truncate2.tar.gz |
mds: avoid leaking objects after purging file.wip-truncate2
The filer implementation does not delete stripe objects that are truncated
to zero. When purging a deleted file, we need to purge stripe objects up to
the max size the file has ever been.
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Diffstat (limited to 'src/mds/MDCache.cc')
-rw-r--r-- | src/mds/MDCache.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 9dc1229fbb9..d3980b3766b 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -9354,8 +9354,12 @@ void MDCache::purge_stray(CDentry *dn) if (in->is_file()) { uint64_t period = (uint64_t)in->inode.layout.fl_object_size * (uint64_t)in->inode.layout.fl_stripe_count; - uint64_t cur_max_size = in->inode.get_max_size(); - uint64_t to = MAX(in->inode.size, cur_max_size); + uint64_t to = in->inode.get_max_size(); + to = MAX(in->inode.size, to); + // when truncating a file, the filer does not delete stripe objects that are + // truncated to zero. so we need to purge stripe objects up to the max size + // the file has ever been. + to = MAX(in->inode.max_size_ever, to); if (to && period) { uint64_t num = (to + period - 1) / period; dout(10) << "purge_stray 0~" << to << " objects 0~" << num |