1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

cache: fix order of metadata change

Start to change metadata after they are archived.
And since cache_pool is virtual skip deactivation
call for this LV.
This commit is contained in:
Zdenek Kabelac 2014-04-01 18:08:38 +02:00
parent d3004479cc
commit e72dea55bf

View File

@ -4688,21 +4688,6 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
} else if (lv_is_thin_volume(lv)) } else if (lv_is_thin_volume(lv))
pool_lv = first_seg(lv)->pool_lv; pool_lv = first_seg(lv)->pool_lv;
/*
* If we are removing a cache_pool, we must first unlink
* it from any origins (i.e. remove the cache layer).
*
* If the cache_pool is not linked, we can simply proceed
* to remove it.
*/
if (lv_is_cache_pool(lv) && !dm_list_empty(&lv->segs_using_this_lv)) {
if (!(cache_seg = get_only_segment_using_this_lv(lv)))
return_0;
if (!lv_cache_remove(cache_seg->lv))
return_0;
}
if (lv_is_cache_pool_data(lv) || lv_is_cache_pool_metadata(lv)) { if (lv_is_cache_pool_data(lv) || lv_is_cache_pool_metadata(lv)) {
log_error("Can't remove logical volume %s used by a cache_pool.", log_error("Can't remove logical volume %s used by a cache_pool.",
lv->name); lv->name);
@ -4760,8 +4745,18 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
return_0; return_0;
} }
/* FIXME Review and fix the snapshot error paths! */ if (lv_is_cache_pool(lv)) {
if (!deactivate_lv(cmd, lv)) { /* Cache pool removal drops cache layer
* If the cache pool is not linked, we can simply remove it. */
if (!dm_list_empty(&lv->segs_using_this_lv)) {
if (!(cache_seg = get_only_segment_using_this_lv(lv)))
return_0;
/* TODO: polling */
if (!lv_cache_remove(cache_seg->lv))
return_0;
}
} else if (!deactivate_lv(cmd, lv)) {
/* FIXME Review and fix the snapshot error paths! */
log_error("Unable to deactivate logical volume \"%s\"", log_error("Unable to deactivate logical volume \"%s\"",
lv->name); lv->name);
return 0; return 0;