Re: Use flock() instead of fcntl()

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

 



Thank you for your quick response!

Am Donnerstag, 25. Juli 2013, 10:31:40 schrieb Daniel P. Berrange:
> On Thu, Jul 25, 2013 at 08:23:24AM +0000, David Weber wrote:
> > Hi,
> > 
> > we are interested in using virtlockd on an OCFS2 shared filesystem.
> > We are now facing the problem that virtlockd uses fcntl() locks which
> > aren't supported by OCFS2 with the o2cb cluster stack and we want
> > to avoid using indirect leases.
> > 
> > OCFS2 instead supports flock() which is quite similar to fcntl(). I
> > attached a patch which makes libvirt use flock() *instead* of fcntl()
> > and it seems to work.
> > 
> > NFS on the contrast only supports fcntl() so it should be configurable
> > which lock type to use.
> > 
> > I'm not very experienced with locking, so would such a patch be
> > acceptable or do you see possible problems with it?
> 
> We definitely can't use flock() unconditionally like that, as it is
> less widely supported than fcntl() locking and is known broken on
> most network filesystems (flock() will only lock wrt the local node,
> not network-wide).

flock() locks are cluster aware in recent versions of OCFS2 and I would try to 
make it configurable which lock type to use.

> 
> I'm pretty surprised that you can fcntl() is not supported in ocfs2.
> Are you really sure about that ?
> 
> This mail message suggests it is supported
> 
>   https://oss.oracle.com/pipermail/ocfs2-users/2009-June/003572.html
> 
> "Support for fcntl locking aka file-range locking aka posix locking is
>  provided by vfs for all file systems. However, that support is appropriate
>  only for local file systems.
> 
>  In ocfs2, we have added support for cluster-aware fcntl locking via
>  the userspace clustering framework that allows one to use ocfs2 with
>  different cluster-stacks."

OCFS2 supports fcntl() only with the userspace cluster stacks (pacemaker and 
cman) which we want to avoid.

SUSE advises to use indirect leases which we also want to avoid:
https://www.suse.com/documentation//sled11/book_kvm/?page=/documentation//sled11/book_kvm/data/sec_libvirt_storage_locking.html

"virtlockd's default configuration does not allow you to lock disk files placed 
on a shared file system (for example NFS or OCFS2). Locking on these file 
systems requires you to specify a lockspace directory on the VM Host Server by 
setting"

Although that's not completely correct because NFS supports fcntl()

Cheers,
David
> 
> Regards,
> Daniel

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]