Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP6:Update
lvm2
0002-lvconvert-fix-ret-values-fro-integrity-rem...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-lvconvert-fix-ret-values-fro-integrity-remove.patch of Package lvm2
From b982d9ac56a709f1ffcdfb052029556bd8d56635 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac <zkabelac@redhat.com> Date: Wed, 9 Aug 2023 13:02:13 +0200 Subject: [PATCH 02/24] lvconvert: fix ret values fro integrity remove Fix return value from _lvconvert_integrity_remove() as it is expected to match _add() and be 0/1. Also add some missing log_error() messages. --- tools/lvconvert.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 49047abb0..c25c87db4 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -6410,24 +6410,26 @@ int lvconvert_to_cache_with_cachevol_cmd(struct cmd_context *cmd, int argc, char static int _lvconvert_integrity_remove(struct cmd_context *cmd, struct logical_volume *lv) { - int ret = 0; - - if (!lv_is_integrity(lv) && !lv_is_raid(lv)) { + if (!lv_is_integrity(lv)) { log_error("LV does not have integrity."); - return ECMD_FAILED; + return 0; + } + + if (!lv_is_raid(lv)) { + log_error("Cannot remove integrity from non raid type LV %s.", + display_lvname(lv)); + return 0; } /* ensure it's not active elsewhere. */ if (!lockd_lv(cmd, lv, "ex", 0)) - return_ECMD_FAILED; + return_0; - if (lv_is_raid(lv)) - ret = lv_remove_integrity_from_raid(lv); - if (!ret) - return_ECMD_FAILED; + if (!lv_remove_integrity_from_raid(lv)) + return_0; log_print_unless_silent("Logical volume %s has removed integrity.", display_lvname(lv)); - return ECMD_PROCESSED; + return 1; } static int _lvconvert_integrity_add(struct cmd_context *cmd, struct logical_volume *lv, @@ -6435,7 +6437,6 @@ static int _lvconvert_integrity_add(struct cmd_context *cmd, struct logical_volu { struct volume_group *vg = lv->vg; struct dm_list *use_pvh; - int ret = 0; /* ensure it's not active elsewhere. */ if (!lockd_lv(cmd, lv, "ex", 0)) @@ -6453,9 +6454,13 @@ static int _lvconvert_integrity_add(struct cmd_context *cmd, struct logical_volu return 0; } - if (lv_is_raid(lv)) - ret = lv_add_integrity_to_raid(lv, set, use_pvh, NULL); - if (!ret) + if (!lv_is_raid(lv)) { + log_error("Cannot add integrity to non raid type LV %s.", + display_lvname(lv)); + return 0; + } + + if (!lv_add_integrity_to_raid(lv, set, use_pvh, NULL)) return_0; log_print_unless_silent("Logical volume %s has added integrity.", display_lvname(lv)); @@ -6466,10 +6471,8 @@ static int _lvconvert_integrity_single(struct cmd_context *cmd, struct logical_volume *lv, struct processing_handle *handle) { - struct integrity_settings settings; - int ret = 0; - - memset(&settings, 0, sizeof(settings)); + struct integrity_settings settings = { 0 }; + int ret; if (!integrity_mode_set(arg_str_value(cmd, raidintegritymode_ARG, NULL), &settings)) return_ECMD_FAILED; @@ -6483,7 +6486,8 @@ static int _lvconvert_integrity_single(struct cmd_context *cmd, ret = _lvconvert_integrity_remove(cmd, lv); if (!ret) - return ECMD_FAILED; + return_ECMD_FAILED; + return ECMD_PROCESSED; } -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor