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

Fix test for lv_snapshot_percent

Do not check for PERCENT_MERGE_FAILED if the lv_snapshot_percent() failed.
(test for snap_percent would be testing uninitialized value).
This commit is contained in:
Zdenek Kabelac 2012-02-08 13:02:07 +00:00
parent a13efe5665
commit 94f88a4f14
2 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.91 -
===================================
Fix test for snap percent for failing merge when removing LV.
Switch int to void return for str_list_del().
Fix error path handling in _build_desc().
Add range test for device number in _scan_proc_dev().

View File

@ -3315,14 +3315,14 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
if (lv_is_merging_cow(lv) && !level) {
if (lv_info(lv->vg->cmd, lv, 0, &info, 1, 0) &&
info.exists && info.live_table) {
if (lv_snapshot_percent(lv, &snap_percent) &&
((snap_percent != PERCENT_INVALID) &&
(snap_percent != PERCENT_MERGE_FAILED))) {
if (!lv_snapshot_percent(lv, &snap_percent))
return_0;
if ((snap_percent != PERCENT_INVALID) &&
(snap_percent != PERCENT_MERGE_FAILED)) {
log_error("Can't remove merging snapshot logical volume \"%s\"",
lv->name);
return 0;
}
else if ((snap_percent == PERCENT_MERGE_FAILED) &&
} else if ((snap_percent == PERCENT_MERGE_FAILED) &&
(force == PROMPT) &&
yes_no_prompt("Removing snapshot \"%s\" that failed to merge may leave origin \"%s\" inconsistent. "
"Proceed? [y/n]: ", lv->name, origin_from_cow(lv)->name) == 'n') {