[dm-devel] [PATCH 1/3] libmultipath: keep existing dm_info if you fail to get a new one

Martin Wilck martin.wilck at suse.com
Fri Dec 3 08:01:11 UTC 2021


On Thu, 2021-12-02 at 19:34 -0600, Benjamin Marzinski wrote:
> There are reasons that dm_get_info() can fail other than the
> multipath
> device not existing. If there is an existing dm_info structure and
> the
> call fails, don't free it.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>

This is ok, but I think it'd be better to simply embed the dmi struct
in struct multipath and thus avoid having allocate and free it
separately. Either that, or just use a struct dm_info on stack  in
dm_get_info() and just copy the properties we actually look at, i.e.
read_only, major, minor, suspended, to respective fields in struct
multipath. I'd prefer embedding the complete dmi, as it's not that
large and contains other interesting fields, too (for example, we might
be able to leverage the event_nr field to avoid duplicate work between
uevent and dmevent handlers).

We would need to be able to figure out if the dmi is valid, but that's
rather easy, we could simply set major = minor = 0.

Regards
Martin





More information about the dm-devel mailing list