[dm-devel] [PATCH] libmpathpersist: fix thread safety of default functions
Martin Wilck
martin.wilck at suse.com
Tue Jan 26 10:04:28 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.
>
> Fixes: a839e39e ("libmpathpersist: factor out initialization and
> teardown")
> Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>
It turns out our CI has caught an actual bug for the first time :-)
https://github.com/openSUSE/multipath-tools/runs/1768201417?check_suite_focus=true#step:8:719
No need to resubmit, I'll just quickly amend this.
Regards
Martin
More information about the dm-devel
mailing list