[dm-devel] [lvm-devel] master - multipathd: fix fd leak when iscsi device logs in
Martin Wilck
mwilck at suse.com
Mon Jul 13 10:27:43 UTC 2020
On Mon, 2020-07-13 at 12:13 +0200, Zdenek Kabelac wrote:
> Dne 13. 07. 20 v 12:08 Martin Wilck napsal(a):
> >
> > Ben has already added support for dm_hold_control_dev() in
> > libmultipath
> > (e24d8b1 ("libmutipath: don't close fd on dm_lib_release")). But
> > this
> > doesn't protect us from calling _open_control() simultaneously in
> > separate code paths, as Lixiaokeng has pointed out.
> >
> > I don't see how it would, as dm_hold_control_dev() also just
> > changes
> > a static variable.
>
> Here I'm not familiar with multipath codebase (more a question for
> Ben
> likely), but is 'dm_hold...()' being used in non-threaded way - i.e.
> in
> dmeventd these functions are called before/after threads are
> finished - so
> there would be no way 2 threads may call this function in parallel ?
Yes, it's called via pthread_once().
@Lixiaokeng, that would suggest a simpler solution to your fd leak
problem than what I posted before. You'd just need to apply Ben's patch
"libmutipath: don't close fd on dm_lib_release" submitted March
24th.
Contrary to what I said before, this patch is NOT merged yet. The commit id e24d8b1 was from my "upstream-queue" branch only
(https://github.com/openSUSE/multipath-tools/tree/upstream-queue)
Could you try with that patch (and without mine sent previously)?
Martin
More information about the dm-devel
mailing list