Google
  Web www.spinics.net

Re: lvm_t handles and thread-safety

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


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


_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


[Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [Photos]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux Resources]

Add to Google Powered by Linux