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

Benjamin Marzinski bmarzins at redhat.com
Tue Jan 26 15:30:35 UTC 2021


On Tue, Jan 26, 2021 at 09:36:59AM +0000, Martin Wilck wrote:
> 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?

Dunno. I just got the bug report saying that their multithreaded
application is crashing.

-Ben

> 
> Regards,
> Martin




More information about the dm-devel mailing list