main - shellcheck: updates
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f678052385dd7fe04e4...
Commit: f678052385dd7fe04e4d4c3681b7dd58b1bca64b
Parent: 6a099707c433f0b3f2644c52f7773751832693a4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 23:22:01 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
shellcheck: updates
Ehance some shellcheck reported issues.
---
scripts/fsadm.sh | 2 +-
scripts/lvmdump.sh.in | 2 +-
scripts/vgimportclone.sh | 12 ++++++------
test/api/dbustest.sh | 2 +-
test/lib/aux.sh | 20 ++++++++++----------
test/lib/check.sh | 6 +++---
test/lib/utils.sh | 2 +-
7 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index 3e1f3d405..9ae422f55 100755
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -383,7 +383,7 @@ detect_device_size() {
test -n "$DEVSIZE" || error "Cannot read size of device \"$VOLUME\"."
SSSIZE=$("$BLOCKDEV" --getss "$VOLUME" || true)
test -n "$SSSIZE" || error "Cannot read sector size of device \"$VOLUME\"."
- DEVSIZE=$(( $DEVSIZE * $SSSIZE ))
+ DEVSIZE=$(( DEVSIZE * SSSIZE ))
fi
}
diff --git a/scripts/lvmdump.sh.in b/scripts/lvmdump.sh.in
index 8507151d8..0685d85fb 100644
--- a/scripts/lvmdump.sh.in
+++ b/scripts/lvmdump.sh.in
@@ -163,7 +163,7 @@ if (( clustered )); then
{
for i in nodes status services; do
- cap_i=$(echo "$i"|tr a-z A-Z)
+ cap_i=$(echo "$i"|tr "[:lower:]" "[:upper:]")
echo "$cap_i:"
echo "----------------------------------"
log "cman_tool $i 2>> \"$log\""
diff --git a/scripts/vgimportclone.sh b/scripts/vgimportclone.sh
index d56827f1e..3d795048a 100755
--- a/scripts/vgimportclone.sh
+++ b/scripts/vgimportclone.sh
@@ -18,11 +18,11 @@
# following external commands are used throughout the script
# echo and test are internal in bash at least
-RM=rm
-BASENAME=basename
-MKTEMP=mktemp
-READLINK=readlink
-GETOPT=getopt
+RM="rm"
+BASENAME="basename"
+MKTEMP="mktemp"
+READLINK="readlink"
+GETOPT="getopt"
# user may override lvm location by setting LVM_BINARY
LVM=${LVM_BINARY:-lvm}
@@ -145,7 +145,7 @@ do
shift
;;
-v|--verbose)
- let VERBOSE_COUNT=VERBOSE_COUNT+1
+ VERBOSE_COUNT=$(( VERBOSE_COUNT + 1 ))
if [ -z "$VERBOSE" ]
then
VERBOSE="-v"
diff --git a/test/api/dbustest.sh b/test/api/dbustest.sh
index 622022277..f4c9c9c2a 100644
--- a/test/api/dbustest.sh
+++ b/test/api/dbustest.sh
@@ -18,7 +18,7 @@ SKIP_WITH_CLVMD=1
. lib/inittest
# Unsupported with valgrid testing
-test ${LVM_VALGRIND:-0} -eq 0 || skip "Unsupported with valgrind"
+test "${LVM_VALGRIND:-0}" -eq 0 || skip "Unsupported with valgrind"
# NOTE: Some tests, namely anything with vdo, and
# api/dbus_test_lv_interface_cache_lv.sh, require larger PVs
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 5cdbe1302..1a1f11a1d 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -586,7 +586,7 @@ teardown() {
}
# Remove any metadata archives and backups from this test on system
- rm -f /etc/lvm/archive/${PREFIX}* /etc/lvm/backup/${PREFIX}*
+ rm -f /etc/lvm/archive/"${PREFIX}"* /etc/lvm/backup/"${PREFIX}"*
echo "ok"
}
@@ -669,7 +669,7 @@ prepare_real_devs() {
aux extend_filter "a|$path|"
dd if=/dev/zero of="$path" bs=32k count=1
wipefs -a "$path" 2>/dev/null || true
- done < $LVM_TEST_DEVICE_LIST
+ done < "$LVM_TEST_DEVICE_LIST"
fi
printf "%s\\n" "${REAL_DEVICES[@]}" > REAL_DEVICES
}
@@ -810,9 +810,9 @@ cleanup_md_dev() {
# try to find and remove any DM device on top of cleaned MD
# assume /dev/mdXXX is 9:MINOR
local minor=${mddev##/dev/md}
- for i in $(dmsetup table | grep 9:$minor | cut -d: -f1) ; do
- dmsetup remove $i || {
- dmsetup --force remove $i || true
+ for i in $(dmsetup table | grep 9:"$minor" | cut -d: -f1) ; do
+ dmsetup remove "$i" || {
+ dmsetup --force remove "$i" || true
}
done
@@ -842,7 +842,7 @@ wipefs_a() {
shift
if test -n "$LVM_TEST_DEVICES_FILE"; then
- lvmdevices --deldev $dev || true
+ lvmdevices --deldev "$dev" || true
fi
if test -f HAVE_WIPEFS ; then
@@ -866,7 +866,7 @@ wipefs_a() {
fi
if test -n "$LVM_TEST_DEVICES_FILE"; then
- lvmdevices --adddev $dev || true
+ lvmdevices --adddev "$dev" || true
fi
udev_wait
@@ -954,10 +954,10 @@ prepare_devs() {
done
if test -n "$LVM_TEST_DEVICES_FILE"; then
- mkdir -p $TESTDIR/etc/lvm/devices || true
- rm $TESTDIR/etc/lvm/devices/system.devices || true
+ mkdir -p "$TESTDIR/etc/lvm/devices" || true
+ rm "$TESTDIR/etc/lvm/devices/system.devices" || true
for d in "${DEVICES[@]}"; do
- lvmdevices --adddev $dev || true
+ lvmdevices --adddev "$dev" || true
done
fi
diff --git a/test/lib/check.sh b/test/lib/check.sh
index 5b119430d..8493bde83 100644
--- a/test/lib/check.sh
+++ b/test/lib/check.sh
@@ -157,7 +157,7 @@ mirror_nonredundant() {
attr=$(get lv_field "$lv" attr)
(echo "$attr" | grep "^......m...$" >/dev/null) || {
if (echo "$attr" | grep "^o.........$" >/dev/null) &&
- lvs -a $1 | grep -F "[${2}_mimage" >/dev/null; then
+ lvs -a "$1" | grep -F "[${2}_mimage" >/dev/null; then
echo "TEST WARNING: $lv is a snapshot origin and looks like a mirror,"
echo "assuming it is actually a mirror"
else
@@ -439,7 +439,7 @@ raid_leg_status() {
# Ignore inconsisten raid status 0/xxxxx idle
for i in {100..0} ; do
- st=( $(dmsetup status $1-$2) ) || die "Unable to get status of $vg/$lv1"
+ st=( $(dmsetup status "$1-$2") ) || die "Unable to get status of $vg/$lv1"
b=( $(echo "${st[6]}" | sed s:/:' ':) )
[ "${b[0]}" = "0" ] || {
test "${st[5]}" = "$3" || break
@@ -448,7 +448,7 @@ raid_leg_status() {
sleep .1
done
- die "$1-$2 status ${st[5]} != $3 ($st)"
+ die "$1-$2 status ${st[5]} != $3 (${st[*]})"
}
grep_dmsetup() {
diff --git a/test/lib/utils.sh b/test/lib/utils.sh
index 400cacd0c..0e41589bd 100644
--- a/test/lib/utils.sh
+++ b/test/lib/utils.sh
@@ -279,7 +279,7 @@ prepare_test_vars() {
while read path; do
count=$(( count + 1 ))
eval "dev$count=\"$path\""
- done < $LVM_TEST_DEVICE_LIST
+ done < "$LVM_TEST_DEVICE_LIST"
else
for i in {1..16}; do
eval "dev$i=\"$DM_DEV_DIR/mapper/${PREFIX}pv$i\""
3 years
main - clang: remove unused assignment
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6a099707c433f0b3f26...
Commit: 6a099707c433f0b3f2644c52f7773751832693a4
Parent: 49caa9f3b1950ffd2ca9aa990e8bf0b480b62b87
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 23 17:27:44 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
clang: remove unused assignment
---
lib/device/dev-md.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/device/dev-md.c b/lib/device/dev-md.c
index 78a77a968..6ddeb5b9e 100644
--- a/lib/device/dev-md.c
+++ b/lib/device/dev-md.c
@@ -55,7 +55,7 @@ static int _dev_has_md_magic(struct device *dev, uint64_t sb_offset)
static int _dev_has_imsm_magic(struct device *dev, uint64_t devsize_sectors)
{
char imsm_signature[IMSM_SIG_LEN];
- uint64_t off = (devsize_sectors * 512) - 1024;
+ uint64_t off;
unsigned int physical_block_size = 0;
unsigned int logical_block_size = 0;
3 years
main - clang: ensure vg is defined
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=49caa9f3b1950ffd2ca...
Commit: 49caa9f3b1950ffd2ca9aa990e8bf0b480b62b87
Parent: 51fd232b8eb2613a198b049d44688ea2422b248a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 22:42:54 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
clang: ensure vg is defined
---
tools/pvchange.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/pvchange.c b/tools/pvchange.c
index b0bc83ed5..d6e35d66f 100644
--- a/tools/pvchange.c
+++ b/tools/pvchange.c
@@ -54,7 +54,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg,
}
/* If in a VG, must change using volume group. */
- if (!is_orphan(pv)) {
+ if (vg && !is_orphan(pv)) {
if (tagargs && !(vg->fid->fmt->features & FMT_TAGS)) {
log_error("Volume group containing %s does not "
"support tags", pv_name);
@@ -134,7 +134,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg,
}
if (arg_is_set(cmd, metadataignore_ARG)) {
- if ((vg_mda_copies(vg) != VGMETADATACOPIES_UNMANAGED) &&
+ if (vg && (vg_mda_copies(vg) != VGMETADATACOPIES_UNMANAGED) &&
(arg_count(cmd, force_ARG) == PROMPT) &&
yes_no_prompt("Override preferred number of copies "
"of VG %s metadata? [y/n]: ",
@@ -175,7 +175,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg,
}
log_verbose("Updating physical volume \"%s\"", pv_name);
- if (!is_orphan(pv)) {
+ if (vg && !is_orphan(pv)) {
if (!vg_write(vg) || !vg_commit(vg)) {
log_error("Failed to store physical volume \"%s\" in "
"volume group \"%s\"", pv_name, vg->name);
3 years
main - clang: avoid possible use-after-free
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=51fd232b8eb2613a198...
Commit: 51fd232b8eb2613a198b049d44688ea2422b248a
Parent: 21bdd0a3597eaa138906bc467f6749e70bc60e78
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 22:08:57 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
clang: avoid possible use-after-free
If the 'act' has been already processed by add_client_result()
it could have been possibly release - so avoid accessin 'act->'
afterward and go for next item directly.
---
daemons/lvmlockd/lvmlockd-core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index cd8485bb0..238ec718b 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -1800,9 +1800,7 @@ static void res_process(struct lockspace *ls, struct resource *r,
act->result = -EINVAL;
list_del(&act->list);
add_client_result(act);
- }
-
- if (act->op == LD_OP_LOCK && act->mode == LD_LK_UN) {
+ } else if (act->op == LD_OP_LOCK && act->mode == LD_LK_UN) {
rv = res_unlock(ls, r, act);
if (rv == -ENOENT && (act->flags & LD_AF_UNLOCK_CANCEL))
3 years
main - clang: always initialized values
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=21bdd0a3597eaa13890...
Commit: 21bdd0a3597eaa138906bc467f6749e70bc60e78
Parent: 8f85834a330c1b803c130d9f7a33633267fb8d5b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 21:49:30 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
clang: always initialized values
---
device_mapper/libdm-report.c | 2 +-
libdm/libdm-report.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/device_mapper/libdm-report.c b/device_mapper/libdm-report.c
index f14aa8bc7..c6e7a2a03 100644
--- a/device_mapper/libdm-report.c
+++ b/device_mapper/libdm-report.c
@@ -3774,7 +3774,7 @@ static struct selection_node *_parse_selection(struct dm_report *rh,
struct field_selection *fs;
struct selection_node *sn;
const char *ws, *we; /* field name */
- const char *vs, *ve; /* value */
+ const char *vs = NULL, *ve = NULL; /* value */
const char *last;
uint32_t flags, field_num;
int implicit;
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 5433e74ae..2efcc07c9 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -3773,7 +3773,7 @@ static struct selection_node *_parse_selection(struct dm_report *rh,
struct field_selection *fs;
struct selection_node *sn;
const char *ws, *we; /* field name */
- const char *vs, *ve; /* value */
+ const char *vs = NULL, *ve = NULL; /* value */
const char *last;
uint32_t flags, field_num;
int implicit;
3 years
main - cov: convert to code that analyzer may better understand
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8f85834a330c1b803c1...
Commit: 8f85834a330c1b803c130d9f7a33633267fb8d5b
Parent: 25b672417e06265c4552184b4ae1f0853bd31732
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 15:06:48 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
cov: convert to code that analyzer may better understand
Switch to code that is problematic to analyzer
---
lib/device/dev-cache.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index dddf84e4d..d7fa93fd6 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -293,13 +293,13 @@ static int _compare_paths(const char *path0, const char *path1)
/* We prefer symlinks - they exist for a reason!
* So we prefer a shorter path before the first symlink in the name.
* FIXME Configuration option to invert this? */
- while (s0) {
- s0 = strchr(s0, '/');
- s1 = strchr(s1, '/');
- if (s0) {
+ while (s0 && s1) {
+ if ((s0 = strchr(s0, '/')))
*s0 = '\0';
+
+ if ((s1 = strchr(s1, '/')))
*s1 = '\0';
- }
+
if (lstat(p0, &stat0)) {
log_sys_very_verbose("lstat", p0);
return 1;
@@ -312,10 +312,10 @@ static int _compare_paths(const char *path0, const char *path1)
return 0;
if (!S_ISLNK(stat0.st_mode) && S_ISLNK(stat1.st_mode))
return 1;
- if (s0) {
+ if (s0)
*s0++ = '/';
+ if (s1)
*s1++ = '/';
- }
}
/* ASCII comparison */
3 years
main - cov: use correct enum type
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=25b672417e06265c455...
Commit: 25b672417e06265c4552184b4ae1f0853bd31732
Parent: 395ce6c2bb034ed64479fcf4bc8974615a0f4bb8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 17:31:17 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
cov: use correct enum type
Correct function declaration.
---
lib/format_text/import_vsn1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c
index ef25369a6..946184b4b 100644
--- a/lib/format_text/import_vsn1.c
+++ b/lib/format_text/import_vsn1.c
@@ -128,7 +128,7 @@ static int _read_id(struct id *id, const struct dm_config_node *cn, const char *
return 1;
}
-static int _read_flag_config(const struct dm_config_node *n, uint64_t *status, int type)
+static int _read_flag_config(const struct dm_config_node *n, uint64_t *status, enum pv_vg_lv_e type)
{
const struct dm_config_value *cv;
*status = 0;
3 years
main - cov: explicitely ignore return value
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=395ce6c2bb034ed6447...
Commit: 395ce6c2bb034ed64479fcf4bc8974615a0f4bb8
Parent: 2b3dcd754ff99987661c47ce57a660bfcfed3ffb
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 16:49:34 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
cov: explicitely ignore return value
---
daemons/lvmlockd/lvmlockd-core.c | 6 +++---
lib/device/device_id.c | 2 +-
lib/label/label.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 094491029..cd8485bb0 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -4968,7 +4968,7 @@ static void *client_thread_main(void *arg_in)
}
out:
if (adopt_opt && lock_acquire_written)
- unlink(adopt_file);
+ (void) unlink(adopt_file);
return NULL;
}
@@ -5740,13 +5740,13 @@ static void adopt_locks(void)
if (count_start_fail || count_adopt_fail)
goto fail;
- unlink(adopt_file);
+ (void) unlink(adopt_file);
write_adopt_file();
log_debug("adopt_locks done");
return;
fail:
- unlink(adopt_file);
+ (void) unlink(adopt_file);
log_error("adopt_locks failed, reset host");
}
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index 9fd22692c..6fa3b0360 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -679,7 +679,7 @@ int device_ids_write(struct cmd_context *cmd)
goto out;
}
- unlink(tmppath); /* in case a previous file was left */
+ (void) unlink(tmppath); /* in case a previous file was left */
if (!(fp = fopen(tmppath, "w+"))) {
log_warn("Cannot open tmp devices_file to write.");
diff --git a/lib/label/label.c b/lib/label/label.c
index f305ac735..203c5b6bb 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -1657,7 +1657,7 @@ bool dev_write_bytes(struct device *dev, uint64_t start, size_t len, void *data)
_scan_dev_close(dev);
dev->flags |= DEV_BCACHE_WRITE;
- label_scan_open(dev);
+ (void) label_scan_open(dev); /* checked later */
}
if (dev->bcache_di < 0) {
3 years
main - cov: check return value
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2b3dcd754ff99987661...
Commit: 2b3dcd754ff99987661c47ce57a660bfcfed3ffb
Parent: 86a3a0c76543d377194d4e86ea31a1a4184e0dc6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 17:00:45 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
cov: check return value
Log problems on fail path.
---
daemons/dmeventd/dmeventd.c | 3 ++-
lib/metadata/lv_manip.c | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 4c3ef74f1..041718c7a 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1742,7 +1742,8 @@ static void _init_thread_signals(void)
sigset_t my_sigset;
struct sigaction act = { .sa_handler = _sig_alarm };
- sigaction(SIGALRM, &act, NULL);
+ if (sigaction(SIGALRM, &act, NULL))
+ log_sys_debug("sigaction", "SIGLARM");
sigfillset(&my_sigset);
/* These are used for exiting */
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index cb6f09362..508f78c13 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6821,7 +6821,8 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
display_lvname(pool_lv));
}
- lockd_lv(cmd, lock_lv, "un", LDLV_PERSISTENT);
+ if (!lockd_lv(cmd, lv, "un", LDLV_PERSISTENT))
+ log_warn("WARNING: Failed to unlock %s.", display_lvname(lv));
lockd_free_lv(cmd, vg, lv->name, &lv->lvid.id[1], lv->lock_args);
if (!suppress_remove_message && (visible || historical)) {
@@ -8858,7 +8859,8 @@ deactivate_and_revert_new_lv:
}
revert_new_lv:
- lockd_lv(cmd, lv, "un", LDLV_PERSISTENT);
+ if (!lockd_lv(cmd, lv, "un", LDLV_PERSISTENT))
+ log_warn("WARNING: Failed to unlock %s.", display_lvname(lv));
lockd_free_lv(vg->cmd, vg, lv->name, &lv->lvid.id[1], lv->lock_args);
/* FIXME Better to revert to backup of metadata? */
3 years
main - cov: fix typo and reduce stack usage
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=86a3a0c76543d377194...
Commit: 86a3a0c76543d377194d4e86ea31a1a4184e0dc6
Parent: e1287c3b711d9d77221b0114dbb5ebd84c09ca48
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 15:27:58 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
cov: fix typo and reduce stack usage
Buffer on stack was for single LV name plus some short text around.
Use of 50* was a typo so use correly 50+.
---
lib/metadata/lv_manip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index ff2a673eb..cb6f09362 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6558,7 +6558,7 @@ static int _lv_remove_check_in_use(struct logical_volume *lv, force_t force)
{
struct volume_group *vg = lv->vg;
const char *volume_type = "";
- char buffer[50 * NAME_LEN * 2] = "";
+ char buffer[50 + NAME_LEN * 2] = "";
int active;
int issue_discards =
(vg->cmd->current_settings.issue_discards &&
3 years