[linux-lvm] lvm_t handles and thread-safety

Alexander Lyakas alex.bolshoy at gmail.com
Sun Aug 21 18:15:32 UTC 2011


Zdenek,
thank you for the clarification.

Alex.


On Mon, Aug 1, 2011 at 2:05 PM, Zdenek Kabelac <zdenek.kabelac at gmail.com> wrote:
> Dne 1.8.2011 10:12, Alexander Lyakas napsal(a):
>> Hello everybody,
>> I am using stock ubuntu natty with lvmlib 2.02.66.
>>
>> In my application I would like to have several threads, each operating
>> on a different VG.
>>
>> When I tried to share the same lvm_t handle between the threads, very
>> soon I got segmentation faults in dm_hash operations. Looking at the
>> code, I indeed saw that the contents of lvm_t are used without
>> synchronization.
>
>
> lvm library is not thread safe and it's quite far from being thread safe.
>
> So there is no point on having 2 handles on 2 VGs - it will not work.
>
>>
>> Are there any plans or intentions to provide some support for
>> threading with lvmlib?
>>
>
> With current version of lvm2 code there is no way.
>
> Just use the pthread mutex around the lvm command. It's serialized in kernel
> anyway. So you cannot gain any speed by using threads. (Check the clvmd code.)
>
>
> Zdenek
>
>
>




More information about the linux-lvm mailing list