Re: Use flock() instead of fcntl()

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

 



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).

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."

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
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]