master - debug: fail in backup is not traced nor error
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d444accdbfdda0712d4...
Commit: d444accdbfdda0712d4a83ac178378580d3f7714
Parent: c3e0ef1a5eef973bb79c3f94653077cc87b250c0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 26 23:27:10 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 27 00:27:36 2017 +0200
debug: fail in backup is not traced nor error
---
lib/metadata/raid_manip.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 774924a..110a7d3 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -2147,8 +2147,8 @@ static int _vg_write_lv_suspend_commit_backup(struct volume_group *vg,
} else if (!(r = vg_commit(vg)))
stack; /* !vg_commit() has implicit vg_revert() */
- if (r && do_backup && !backup(vg))
- log_error("Backup of VG %s failed; continuing.", vg->name);
+ if (r && do_backup)
+ backup(vg);
return r;
}
6 years, 10 months
master - debug: tracing error path
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c3e0ef1a5eef973bb79...
Commit: c3e0ef1a5eef973bb79c3f94653077cc87b250c0
Parent: c440bb0742fa70ca37ead55b7edd18e2f7a19eda
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 26 23:21:22 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 27 00:27:36 2017 +0200
debug: tracing error path
---
tools/lvm.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tools/lvm.c b/tools/lvm.c
index 0554007..4bfa6f5 100644
--- a/tools/lvm.c
+++ b/tools/lvm.c
@@ -335,7 +335,8 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
free(input);
if (cmd->cmd_report.report_group) {
- dm_report_group_destroy(cmd->cmd_report.report_group);
+ if (!dm_report_group_destroy(cmd->cmd_report.report_group))
+ stack;
cmd->cmd_report.report_group = NULL;
}
6 years, 10 months
master - debug: check for fail in id validation
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c440bb0742fa70ca37e...
Commit: c440bb0742fa70ca37ead55b7edd18e2f7a19eda
Parent: 3e331c8e68d5f80cacc194625ad97ee4c26fc3ee
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 26 23:20:29 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 27 00:27:36 2017 +0200
debug: check for fail in id validation
---
lib/metadata/metadata.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index b44f2df..45495dc 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4149,7 +4149,8 @@ static int _check_or_repair_pv_ext(struct cmd_context *cmd,
if (!pvl->pv->dev) {
/* is_missing_pv doesn't catch NULL dev */
memset(&uuid, 0, sizeof(uuid));
- id_write_format(&pvl->pv->id, uuid, sizeof(uuid));
+ if (!id_write_format(&pvl->pv->id, uuid, sizeof(uuid)))
+ goto_out;
log_warn("WARNING: Not repairing PV %s with missing device.", uuid);
continue;
}
6 years, 10 months
master - cleanup: remove unused code
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3e331c8e68d5f80cacc...
Commit: 3e331c8e68d5f80cacc194625ad97ee4c26fc3ee
Parent: ab6f4649a0d533b84a7496d88acefa318212d162
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 26 23:19:57 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 27 00:27:25 2017 +0200
cleanup: remove unused code
---
lib/metadata/raid_manip.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 158bcf2..774924a 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -2163,12 +2163,6 @@ static int _vg_write_commit_backup(struct volume_group *vg)
return 1;
}
-__attribute__ ((__unused__))
-static int _vg_write_commit(struct volume_group *vg)
-{
- return _vg_write_lv_suspend_commit_backup(vg, NULL, 1, 0);
-}
-
/* Write vg of @lv, suspend @lv and commit the vg */
static int _vg_write_lv_suspend_vg_commit(struct logical_volume *lv, int origin_only)
{
6 years, 10 months
master - dev_manager: add missing validation for usable target_name
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ab6f4649a0d533b84a7...
Commit: ab6f4649a0d533b84a7496d88acefa318212d162
Parent: b1e21cf9ed585796cd2d265c3bda50b7960b0478
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 26 23:34:38 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 27 00:27:25 2017 +0200
dev_manager: add missing validation for usable target_name
Coverity shown path where target_name == NULL would be dereferenced.
---
lib/activate/dev_manager.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index d10a917..daddfc8 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -275,7 +275,8 @@ static int _info_run(const char *dlid, struct dm_info *dminfo,
target_params = NULL; /* Marking this target_params unusable */
} while (target);
- if (!_get_segment_status_from_target_params(target_name, target_params, seg_status))
+ if (!target_name ||
+ !_get_segment_status_from_target_params(target_name, target_params, seg_status))
stack;
}
6 years, 10 months
master - raid: fix write_commit_backup
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b1e21cf9ed585796cd2...
Commit: b1e21cf9ed585796cd2d265c3bda50b7960b0478
Parent: 52f4042f1a3b21054041298d7e50ded7ae366f44
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 26 23:25:24 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 27 00:27:25 2017 +0200
raid: fix write_commit_backup
With commit 41c10034aa0db3c63f18ff78b64af3a799c154a1 we actually
do require LV to be used with _vg_write_lv_suspend_commit_backup().
So write a proper separte single wrapper for write && commit && backup.
---
lib/metadata/raid_manip.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 2d735ed..158bcf2 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -2155,7 +2155,12 @@ static int _vg_write_lv_suspend_commit_backup(struct volume_group *vg,
static int _vg_write_commit_backup(struct volume_group *vg)
{
- return _vg_write_lv_suspend_commit_backup(vg, NULL, 1, 1);
+ if (!vg_write(vg) || !vg_commit(vg))
+ return_0;
+
+ backup(vg);
+
+ return 1;
}
__attribute__ ((__unused__))
6 years, 10 months
master - cmdline: fix missing NULL at end of array of args
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=52f4042f1a3b2105404...
Commit: 52f4042f1a3b21054041298d7e50ded7ae366f44
Parent: 4e4067dd94f52f90f0aaae30c522102ccbaa2826
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 26 20:03:05 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jun 26 20:07:21 2017 +0200
cmdline: fix missing NULL at end of array of args
lvm_run needs to place NULL as the last element into argv[].
Otherwise we get:
Conditional jump or move depends on uninitialised value(s)
_command_required_pos_matches (lvmcmdline.c:1443)
_find_command (lvmcmdline.c:1610)
lvm_run_command (lvmcmdline.c:2770)
lvm2_run (lvmcmdlib.c:91)
---
WHATS_NEW | 1 +
test/api/test.c | 3 +++
tools/lvmcmdline.c | 3 +++
3 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6a60f0b..2872dbb 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
+ Add missing NULL to argv array when spliting cmdline arguments.
Add display_percent helper function for printing percent values.
Lvconvert --repair handles failing raid legs (present but marked 'D'ead).
Do not lvdisplay --maps unset settings of cache pool.
diff --git a/test/api/test.c b/test/api/test.c
index 1413030..a79afc1 100644
--- a/test/api/test.c
+++ b/test/api/test.c
@@ -51,6 +51,9 @@ static int lvm_split(char *str, int *argc, char **argv, int max)
break;
}
+ if (*argc < max)
+ argv[*argc] = NULL;
+
return *argc;
}
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 9e77d48..0aca37a 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -3045,6 +3045,9 @@ int lvm_split(char *str, int *argc, char **argv, int max)
break;
}
+ if (*argc < max)
+ argv[*argc] = NULL;
+
return *argc;
}
6 years, 10 months
master - libdm: fix initialization of head for reused structure
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4e4067dd94f52f90f0a...
Commit: 4e4067dd94f52f90f0aaae30c522102ccbaa2826
Parent: 0cc49bda15c041dc6e53b17a10b9306abd7d1a93
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 26 18:22:40 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jun 26 19:45:11 2017 +0200
libdm: fix initialization of head for reused structure
Dmeventd reuses 'dm_task' struct for some STATUS operation, but due to
missing reinitization of dm_task target list, it has caused misprocesing
of recieved events as the parsed target has been simply added to the
list of existing status and cause multiple actions being called for
single event.
---
WHATS_NEW_DM | 1 +
libdm/ioctl/libdm-iface.c | 10 +++++++++-
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 89f4a00..2e31b9a 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.141 -
===============================
+ Fix reusing of dm_task structure for status reading (used by dmeventd).
Add dm_percent_to_round_float for adjusted percentage rounding.
Reset array with dead rimage devices once raid gets in sync.
Drop unneeded --config option from raid dmeventd plugin.
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index cb3e8dc..65e75f6 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -467,7 +467,7 @@ static void _dm_zfree_dmi(struct dm_ioctl *dmi)
}
}
-void dm_task_destroy(struct dm_task *dmt)
+static void _dm_task_free_targets(struct dm_task *dmt)
{
struct target *t, *n;
@@ -478,6 +478,12 @@ void dm_task_destroy(struct dm_task *dmt)
dm_free(t);
}
+ dmt->head = dmt->tail = NULL;
+}
+
+void dm_task_destroy(struct dm_task *dmt)
+{
+ _dm_task_free_targets(dmt);
_dm_zfree_dmi(dmt->dmi.v4);
dm_free(dmt->dev_name);
dm_free(dmt->mangled_dev_name);
@@ -652,6 +658,8 @@ static int _unmarshal_status(struct dm_task *dmt, struct dm_ioctl *dmi)
uint32_t i;
struct dm_target_spec *spec;
+ _dm_task_free_targets(dmt);
+
for (i = 0; i < dmi->target_count; i++) {
spec = (struct dm_target_spec *) outptr;
if (!dm_task_add_target(dmt, spec->sector_start,
6 years, 10 months
master - tests: show more debug info
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0cc49bda15c041dc6e5...
Commit: 0cc49bda15c041dc6e53b17a10b9306abd7d1a93
Parent: 1b9bf5ce9e65c22e5e06025ca9700cecd8addc68
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Jun 24 23:01:26 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Jun 24 23:02:42 2017 +0200
tests: show more debug info
Helpful for analysis (revert later).
---
test/shell/lvconvert-repair-raid-dmeventd.sh | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvconvert-repair-raid-dmeventd.sh b/test/shell/lvconvert-repair-raid-dmeventd.sh
index 84b0591..5b5bdcc 100644
--- a/test/shell/lvconvert-repair-raid-dmeventd.sh
+++ b/test/shell/lvconvert-repair-raid-dmeventd.sh
@@ -33,4 +33,7 @@ mkfs.ext3 "$DM_DEV_DIR/$vg/4way"
sleep 5 # FIXME: need a "poll" utility, akin to "check"
aux enable_dev "$dev2" "$dev4"
-vgremove -ff $vg
+dmsetup table
+dmsetup status
+dmsetup info -c
+vgremove -vvvv -ff $vg
6 years, 10 months
master - tests: slightly longer delay
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1b9bf5ce9e65c22e5e0...
Commit: 1b9bf5ce9e65c22e5e06025ca9700cecd8addc68
Parent: c465ca6a3acd2b01ddacac2275bd965bde2b4167
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Jun 24 22:58:08 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Jun 24 22:58:08 2017 +0200
tests: slightly longer delay
Try to avoid race with slightly longer delay.
---
test/shell/lvconvert-cache-abort.sh | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvconvert-cache-abort.sh b/test/shell/lvconvert-cache-abort.sh
index 899fa42..17b5d27 100644
--- a/test/shell/lvconvert-cache-abort.sh
+++ b/test/shell/lvconvert-cache-abort.sh
@@ -39,11 +39,13 @@ done
# Delay dev to ensure we have some time to 'capture' interrupt in flush
aux delay_dev "$dev1" 0 500 $(get first_extent_sector "$dev1"):
+lvdisplay --maps $vg
+sync
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=4k count=100 conv=fdatasync
LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -v --splitcache $vg/$lv1 >log 2>&1 &
PID_CONVERT=$!
-sleep 0.1
+sleep 0.2
kill -INT $PID_CONVERT
aux enable_dev "$dev1"
wait
6 years, 10 months