1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
Jonathan Brassow 2013-07-19 10:01:48 -05:00
parent f0ab6c33a9
commit 4eea660191
2 changed files with 3 additions and 0 deletions

View File

@ -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.

View File

@ -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);