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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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


--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux