diff options
author | Jonathan Brassow <jbrassow@redhat.com> | 2013-07-19 10:01:48 -0500 |
---|---|---|
committer | Jonathan Brassow <jbrassow@redhat.com> | 2013-07-19 10:01:48 -0500 |
commit | 4eea66019157abd992c8802564b675fd97420c01 (patch) | |
tree | 08eebec7629790a59971649596e3bed6adc6b061 | |
parent | f0ab6c33a9475502ea8af1cf54addba68f97428f (diff) | |
download | lvm2-4eea66019157abd992c8802564b675fd97420c01.tar.gz |
RAID: Fix segfault when reporting raid_syncaction field on older kernel
The status printed for dm-raid targets on older kernels does not include
the syncaction field. This is handled by dev_manager_raid_status() just
fine by populating the raid status structure with NULL for that field.
However, lv_raid_sync_action() does not properly handle that field being
NULL. So, check for it and return 0 if it is NULL.
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rw-r--r-- | lib/activate/activate.c | 2 |
2 files changed, 3 insertions, 0 deletions
@@ -1,5 +1,6 @@ Version 2.02.99 - =================================== + Fix segfault when reporting raid_syncaction for older kernels. Add LV reporting fields raid_mismatch_count, raid_sync_action, raid_write_behind. Add LV reporting fields raid_min_recovery_rate, raid_max_recovery_rate. Add sync_percent as alias for copy_percent LV reporting field. diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 204cceb40..61dbc02a9 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -874,7 +874,9 @@ int lv_raid_sync_action(const struct logical_volume *lv, char **sync_action) if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1))) return_0; + /* status->sync_action can be NULL if dm-raid version < 1.5.0 */ if (!dev_manager_raid_status(dm, lv, &status) || + !status->sync_action || !(action = dm_pool_strdup(lv->vg->cmd->mem, status->sync_action))) { dev_manager_destroy(dm); |