mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
lvconvert: fix error path on writecache removal
After setting ret=0 there was missing 'goto out_release'. Simplify with setting ret to 0 at front and to 1 at succesful end.
This commit is contained in:
parent
127c2fc6e2
commit
7a99dac9ad
@ -5751,7 +5751,7 @@ static int _lvconvert_detach_writecache_when_clean(struct cmd_context *cmd,
|
||||
struct logical_volume *lv_fast;
|
||||
uint32_t lockd_state, error_flags;
|
||||
uint64_t dirty;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
idl = dm_list_item(dm_list_first(&lr->poll_idls), struct convert_poll_id_list);
|
||||
id = idl->id;
|
||||
@ -5780,13 +5780,11 @@ static int _lvconvert_detach_writecache_when_clean(struct cmd_context *cmd,
|
||||
|
||||
if (!vg) {
|
||||
log_error("Detaching writecache interrupted - reading VG failed.");
|
||||
ret = 0;
|
||||
goto out_lockd;
|
||||
}
|
||||
|
||||
if (error_flags) {
|
||||
log_error("Detaching writecache interrupted - reading VG error %x.", error_flags);
|
||||
ret = 0;
|
||||
goto out_release;
|
||||
}
|
||||
|
||||
@ -5797,13 +5795,11 @@ static int _lvconvert_detach_writecache_when_clean(struct cmd_context *cmd,
|
||||
|
||||
if (!lv) {
|
||||
log_error("Detaching writecache interrupted - LV not found.");
|
||||
ret = 0;
|
||||
goto out_release;
|
||||
}
|
||||
|
||||
if (!lv_is_active(lv)) {
|
||||
log_error("Detaching writecache interrupted - LV not active.");
|
||||
ret = 0;
|
||||
goto out_release;
|
||||
}
|
||||
|
||||
@ -5840,7 +5836,6 @@ static int _lvconvert_detach_writecache_when_clean(struct cmd_context *cmd,
|
||||
|
||||
if (!lv_detach_writecache_cachevol(lv, 1)) {
|
||||
log_error("Detaching writecache cachevol failed.");
|
||||
ret = 0;
|
||||
goto out_release;
|
||||
}
|
||||
|
||||
@ -5851,7 +5846,7 @@ static int _lvconvert_detach_writecache_when_clean(struct cmd_context *cmd,
|
||||
if (lr->remove_cache) {
|
||||
if (lvremove_single(cmd, lv_fast, NULL) != ECMD_PROCESSED) {
|
||||
log_error("Removing the writecache cachevol failed.");
|
||||
ret = 0;
|
||||
goto out_release;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user