1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

vgremove tries to remove lv snapshot first.

Added function lv_remove_with_dependencies().
This commit is contained in:
Zdeněk Kabeláč 2008-08-05 12:05:26 +00:00
parent 5406e3b7c5
commit 04c0dba697
4 changed files with 28 additions and 2 deletions

View File

@ -1,5 +1,7 @@
Version 2.02.40 -
================================
vgremove tries to remove lv snapshot first.
Added function lv_remove_with_dependencies().
Improve file descriptor leak detection to display likely culprit and filename.
Change clustered mirror kernel module name from cmirror to dm-log-clustered.
Avoid looping forever in _pv_analyze_mda_raw used by pvck.

View File

@ -2048,6 +2048,27 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
return 1;
}
/*
* remove LVs with its dependencies - LV leaf nodes should be removed first
*/
int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *lv,
const force_t force)
{
struct list *snh, *snht;
if (lv_is_origin(lv)) {
/* remove snapshot LVs first */
list_iterate_safe(snh, snht, &lv->snapshot_segs) {
if (!lv_remove_with_dependencies(cmd, list_struct_base(snh, struct lv_segment,
origin_list)->cow,
force))
return 0;
}
}
return lv_remove_single(cmd, lv, force);
}
/*
* insert_layer_for_segments_on_pv() inserts a layer segment for a segment area.
* However, layer modification could split the underlying layer segment.

View File

@ -416,6 +416,9 @@ int lv_remove(struct logical_volume *lv);
int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
force_t force);
int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *lv,
force_t force);
int lv_rename(struct cmd_context *cmd, struct logical_volume *lv,
const char *new_name);

View File

@ -298,8 +298,8 @@ static int remove_lvs_in_vg(struct cmd_context *cmd,
{
struct lv_list *lvl;
list_iterate_items(lvl, &vg->lvs)
if (!lv_remove_single(cmd, lvl->lv, force))
while ((lvl = list_first(&vg->lvs)))
if (!lv_remove_with_dependencies(cmd, lvl->lv, force))
return 0;
return 1;