[dm-devel] [lvm-devel] master - multipathd: fix fd leak when iscsi device logs in

Zdenek Kabelac zkabelac at redhat.com
Mon Jul 13 09:56:29 UTC 2020


Dne 13. 07. 20 v 11:21 Martin Wilck napsal(a):
> Hi Lixiaokeng,
> 
>
> @Zdenek, do we have to protect every libdm call, or is it sufficient
> to protect only dm_task_run(), as lixiaokeng suggested?
>

Hi

It's actually hard to answer it in a simple way.
Several properties are held in library static variables. So converting libdm
into a fully threaded 'version' would basically require to duplicate all API 
functions with extended 'context' structure passed in - where all buffers can 
be maintained properly (and it's getting more complicated with signal handling 
and debug logging).

ATM it doesn't look like there is a big need for threaded support of DM usage
as majority of tools spends most of their time outside thus 'serialization'
of lvm2 or dmeventd on libdm access look doesn't look like a big issue
(let's say there are far bigger fishes to hunt).

As for the issue of keeping control_fd open - there should be a synchronized 
call of dm_hold_control_dev(0/1) -  see the codebase of  dmeventd.c in lvm2 
code base - how we solve the control_fd handling.

Zdenek




More information about the dm-devel mailing list