[dm-devel] [PATCH] libmpathpersist: fix thread safety of default functions

Martin Wilck martin.wilck at suse.com
Tue Jan 26 09:36:59 UTC 2021


On Mon, 2021-01-25 at 23:31 -0600, Benjamin Marzinski wrote:
> commit a839e39e ("libmpathpersist: factor out initialization and
> teardown") made mpath_presistent_reserve_{in,out} use share variables
> for curmp and pathvec.  There are users of this library that call
> these
> functions in a multi-threaded process, and this change causes their
> application to crash. config and udev are also shared variables, but
> libmpathpersist doesn't write to the config in
> mpath_presistent_reserve_{in,out}, and looking into the libudev code,
> I
> don't see any place where libmpathpersist uses the udev object in a
> way
> that isn't thread-safe.
> 
> This patch makes mpath_presistent_reserve_{in,out} go back to using
> local variables for curmp and pathvec, so that multiple threads won't
> be operating on these variables at the same time.

Reviewed-by: Martin Wilck <mwilck at suse.com>

Out of curiosity: what's the multi-threaded application?

Regards,
Martin





More information about the dm-devel mailing list