mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-09 12:58:41 +03:00
cache: lvremoved cached LV removes cache pool
When we remove cached volume, whole tree must go down. There is 'lvconvert --splitcache' to preserve cache pool.
This commit is contained in:
parent
cb273fe164
commit
75119d85b3
@ -1,5 +1,6 @@
|
||||
Version 2.02.112 -
|
||||
=====================================
|
||||
Lvremoving cached LV removes cachepool (keep with lvconvert --splitcache).
|
||||
Always remove spare LV with last removed pool volume.
|
||||
Support lvconvert --splitcache and --uncache of cached LV.
|
||||
Option --cache has also shortcut -H (i.e. lvcreate -H).
|
||||
|
@ -1272,6 +1272,7 @@ static int _lv_reduce(struct logical_volume *lv, uint32_t extents, int delete)
|
||||
struct lv_segment *seg;
|
||||
uint32_t count = extents;
|
||||
uint32_t reduction;
|
||||
struct logical_volume *pool_lv;
|
||||
|
||||
if (lv_is_merging_origin(lv)) {
|
||||
log_debug_metadata("Dropping snapshot merge of %s to removed origin %s.",
|
||||
@ -1302,8 +1303,13 @@ static int _lv_reduce(struct logical_volume *lv, uint32_t extents, int delete)
|
||||
if (delete && seg_is_cache(seg) && !lv_remove(seg_lv(seg, 0)))
|
||||
return_0;
|
||||
|
||||
if (seg->pool_lv && !detach_pool_lv(seg))
|
||||
return_0;
|
||||
if ((pool_lv = seg->pool_lv)) {
|
||||
if (!detach_pool_lv(seg))
|
||||
return_0;
|
||||
/* When removing cached LV, remove pool as well */
|
||||
if (seg_is_cache(seg) && !lv_remove(pool_lv))
|
||||
return_0;
|
||||
}
|
||||
|
||||
dm_list_del(&seg->list);
|
||||
reduction = seg->len;
|
||||
@ -5454,6 +5460,19 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
if (!archive(vg))
|
||||
return 0;
|
||||
|
||||
if (lv_is_cache(lv)) {
|
||||
if (!lv_remove_single(cmd, first_seg(lv)->pool_lv, force,
|
||||
suppress_remove_message)) {
|
||||
if (force < DONT_PROMPT_OVERRIDE) {
|
||||
log_error("Failed to uncache %s.", display_lvname(lv));
|
||||
return 0;
|
||||
}
|
||||
/* Proceed with -ff */
|
||||
log_print_unless_silent("Ignoring uncache failure of %s.",
|
||||
display_lvname(lv));
|
||||
}
|
||||
}
|
||||
|
||||
if (lv_is_cow(lv)) {
|
||||
/* Old format1 code */
|
||||
if (!(lv->vg->fid->fmt->features & FMT_MDAS))
|
||||
|
Loading…
x
Reference in New Issue
Block a user