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

Re: [linux-lvm] lvm_t handles and thread-safety



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



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