[Linux-cluster] Types of file locking support in GFS

Matthew B. Brookover mbrookov at mines.edu
Wed Dec 12 19:25:41 UTC 2007


Test carefully, and look at your code.  If your program needs to promote
a shared lock to an exclusive lock, GFS will allow another program to
steal the lock.  flock frees the program's shared lock and then tries to
get an exclusive lock, another thread can sneak in and get a lock.  This
can cause data corruption if your program expects flock to promote or
demote a lock without allowing another process to modify the file.

This is not a problem on EXT3.  EXT3 will allow a lock to be promoted
from shared to exclusive and not allow a second program to sneak in.

See https://bugzilla.redhat.com/show_bug.cgi?id=252000 for more details.

Red Hat said that I should modify my code to use fcntl.  Unfortunately,
we may end up dropping GFS, and the cluster suite instead.

Matt


On Sat, 2007-12-08 at 10:09 +0000, Elliot Moore wrote:

> On 6 Dec 2007, at 13:45, Elliot Moore wrote:
> > Hi,
> >
> > I'm trying to setup activemq with master and slave.
> > According to http://activemq.apache.org/shared-file-system-master-slave.html 
> > , you can use a SAN to hold a lockfile for multiple brokers to watch.
> > But the SAN filesystem must support exclusive file locks.
> >
> > OCFS2 only supports locking with 'fcntl' and not 'lockf and flock',  
> > therefore mutex file locking from Java isn't supported. (both  
> > brokers think they have
> > an exclusive lock on the lockfile!)
> >
> > Does Redhat GFS support 'lockf and flock' as well as fcntl ?
> 
> 
> FYI
> got a response from redhat, yes
> more information @ http://sources.redhat.com/cluster/faq.html#gfs_vs_ocfs2
> 
> 
> 
> 
> --
> Linux-cluster mailing list
> Linux-cluster at redhat.com
> https://www.redhat.com/mailman/listinfo/linux-cluster
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/linux-cluster/attachments/20071212/4829182e/attachment.htm>


More information about the Linux-cluster mailing list