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

raid: update dm_get_status_raid

Handle mismatch of reported 'dm raid' status, where the active
raid LV can be actually showing higher numebr of raid leg devices,
that the number of shown status characters.

This can happen if the raid leg is dropped during initial
resynchronization.
This commit is contained in:
Zdenek Kabelac 2024-03-24 22:42:16 +01:00
parent f09a992720
commit 2eff6e1974
3 changed files with 21 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.198 - Version 1.02.198 -
=================== ===================
Enhance dm_get_status_raid to handle mismatching status or reported legs.
Create /dev/disk/by-label symlinks for DM devs that have crypto as next layer. Create /dev/disk/by-label symlinks for DM devs that have crypto as next layer.
Persist udev db for DM devs on cleanup used in initrd to rootfs transition. Persist udev db for DM devs on cleanup used in initrd to rootfs transition.
Process synthetic udev events other than 'add/change' as 'change' events. Process synthetic udev events other than 'add/change' as 'change' events.

View File

@ -117,9 +117,18 @@ int dm_get_status_raid(struct dm_pool *mem, const char *params,
if (!(s->raid_type = dm_pool_strndup(mem, params, pp - params - 1))) if (!(s->raid_type = dm_pool_strndup(mem, params, pp - params - 1)))
goto_bad; /* memory is freed when pool is destroyed */ goto_bad; /* memory is freed when pool is destroyed */
if (!(s->dev_health = dm_pool_strndup(mem, p, i)) || !(p = _skip_fields(p, 1))) /* health chars */ if (!(pp = _skip_fields(p, 1)))
goto_bad; goto_bad;
/* Raid target can actually report more then real number of legs in a case
* raid legs have been removed during initial raid array resynchronization */
if (i > (pp - p - 1))
i = pp - p - 1;
if (!(s->dev_health = dm_pool_strndup(mem, p, i))) /* health chars */
goto_bad;
p = pp;
s->dev_count = i; s->dev_count = i;
if (sscanf(p, FMTu64 "/" FMTu64, &s->insync_regions, &s->total_regions) != 2) if (sscanf(p, FMTu64 "/" FMTu64, &s->insync_regions, &s->total_regions) != 2)
goto_bad; goto_bad;

View File

@ -117,9 +117,18 @@ int dm_get_status_raid(struct dm_pool *mem, const char *params,
if (!(s->raid_type = dm_pool_strndup(mem, params, pp - params - 1))) if (!(s->raid_type = dm_pool_strndup(mem, params, pp - params - 1)))
goto_bad; /* memory is freed when pool is destroyed */ goto_bad; /* memory is freed when pool is destroyed */
if (!(s->dev_health = dm_pool_strndup(mem, p, i)) || !(p = _skip_fields(p, 1))) /* health chars */ if (!(pp = _skip_fields(p, 1)))
goto_bad; goto_bad;
/* Raid target can actually report more then real number of legs in a case
* raid legs have been removed during initial raid array resynchronization */
if (i > (pp - p - 1))
i = pp - p - 1;
if (!(s->dev_health = dm_pool_strndup(mem, p, i))) /* health chars */
goto_bad;
p = pp;
s->dev_count = i; s->dev_count = i;
if (sscanf(p, FMTu64 "/" FMTu64, &s->insync_regions, &s->total_regions) != 2) if (sscanf(p, FMTu64 "/" FMTu64, &s->insync_regions, &s->total_regions) != 2)
goto_bad; goto_bad;