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

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.
This commit is contained in:
Zdenek Kabelac 2017-06-26 18:22:40 +02:00
parent 0cc49bda15
commit 4e4067dd94
2 changed files with 10 additions and 1 deletions

View File

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

View File

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