diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2014-04-01 17:57:14 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2014-04-01 20:17:10 +0200 |
commit | 0a15a210a532f7d1d46b042adbd8d3c65793f103 (patch) | |
tree | 28fb0994e049cbc1c203d157c71e37fb01d70e1f | |
parent | a018c57f0bd36f1b56c67a2afe5254e6da8251b7 (diff) | |
download | lvm2-0a15a210a532f7d1d46b042adbd8d3c65793f103.tar.gz |
cache: cache segment is non-discardable
Since cache segment is purely virtual mapping, it has nothing for
discard. Discardable is cache origin here which is now
properly removed on 'delete' phase.
Plain lv_empty() call needs to only detach cache origin and leave
origin unchanged.
-rw-r--r-- | lib/metadata/lv_manip.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 17933a24c..618c1a1b7 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -561,8 +561,7 @@ static int _release_and_discard_lv_segment_area(struct lv_segment *seg, uint32_t return 1; } - if (seg_is_cache(seg) || - (seg_lv(seg, s)->status & MIRROR_IMAGE) || + if ((seg_lv(seg, s)->status & MIRROR_IMAGE) || (seg_lv(seg, s)->status & THIN_POOL_DATA) || (seg_lv(seg, s)->status & CACHE_POOL_DATA)) { if (!lv_reduce(seg_lv(seg, s), area_reduction)) @@ -814,6 +813,10 @@ static int _lv_reduce(struct logical_volume *lv, uint32_t extents, int delete) if (seg->metadata_lv && !lv_remove(seg->metadata_lv)) return_0; + /* Remove cache origin only when removing (not on lv_empty()) */ + if (delete && seg_is_cache(seg) && !lv_remove(seg_lv(seg, 0))) + return_0; + if (seg->pool_lv && !detach_pool_lv(seg)) return_0; |