1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvremove: remove attached cachevol with removed LV

When an LV is removed that has an attached cachevol,
also remove the cachevol LV.
This commit is contained in:
David Teigland 2019-09-24 13:46:40 -05:00
parent 3b36de573e
commit 56aadd7fe2

View File

@ -6283,10 +6283,16 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
return_0;
if (lv_is_cache(lv) && lv_is_cache_vol(first_seg(lv)->pool_lv)) {
struct logical_volume *cachevol_lv = first_seg(lv)->pool_lv;
if (!lv_detach_cache_vol(lv, 0)) {
log_error("Failed to detach cache from %s", display_lvname(lv));
return 0;
}
if (!lv_remove_single(cmd, cachevol_lv, force, suppress_remove_message)) {
log_error("Failed to remove cachevol %s.", display_lvname(cachevol_lv));
return 0;
}
}
/* FIXME Ensure not referred to by another existing LVs */