[Linux-cluster] CLVM/GFS2 distributed locking

Stevo Slavić sslavic at gmail.com
Thu Jan 5 00:00:20 UTC 2012


Here is a simple C utility for locking file - it's combination of two
sources:
- reading lock info from here:
http://uw714doc.sco.com/en/SDK_sysprog/_Getting_Lock_Information.html
- acquiring file lock from here:
http://siber.cankaya.edu.tr/ozdogan/SystemsProgramming/ceng425/node161.html

Now, to make use of it.

Regards,
Stevo.

On Wed, Jan 4, 2012 at 6:10 PM, Stevo Slavić <sslavic at gmail.com> wrote:

> Hello Steven,
>
> I guess license covers only 5.4. Anyway I'm just told it's not an option
> at the moment to do the upgrade.
>
>
> About locking used, ActiveMQ uses Java 6 standard API for trying to
> acquire file lock, here is javadoc for the method used:
>
>
> http://docs.oracle.com/javase/6/docs/api/java/nio/channels/FileChannel.html#tryLock%28long,%20long,%20boolean%29
>
> ActiveMQ tries to obtain non-shared (thus exclusive) lock on whole file on
> shared file system, with range from 0 to 1, since the file being locked is
> empty. As documentation states, tryLock is non-blocking, it executes
> immediately. If ActiveMQ fails to obtain a lock it will  loop (pause and
> retry acquiring lock again) until lock is obtained. In initial state first
> node obtains lock and becomes master, second one fails to obtain lock and
> gets into this loop, as expected. Problem is that slave ActiveMQ on cannot
> obtain a lock even after first node gets fenced - it reports that the file
> on shared storage is still locked. Simple custom java tool that I made
> reports the same, that the file is locked.
>
> OpenJDK 1.6 update 20 is being used as Java runtime. I haven't yet found
> in openjdk source exact code which tryLock will call on Linux.
>
>
> Is there non-Java tool that could be used to reliably check if a file (on
> gfs2) is (or can be) exclusively locked (regardless of where the process
> holding lock is  running, on same or different node where the tool is being
> run)?
>
>
> Regards,
> Stevo.
>
>
>
>
> On Tue, Jan 3, 2012 at 10:59 AM, Steven Whitehouse <swhiteho at redhat.com>wrote:
>
>> Hi,
>>
>> On Fri, 2011-12-30 at 14:39 +0100, Stevo Slavić wrote:
>> > Hello RedHat Linux cluster community,
>> >
>> > I'm in process of configuring shared filesystem storage master/slave
>> > Apache ActiveMQ setup. For it to work, it requires reliable
>> > distributed locking - master is node that holds exclusive lock on a
>> > file on shared filesystem storage.
>> >
>> How does it do this locking? There are several possible ways this might
>> be done, and some will work better than others.
>>
>> > On RHEL (5.4), using CLVM with GFS2 is one of the options that should
>> > work.
>> Why are you using RHEL 5.4 and not something more recent? Note that if
>> you are a Red Hat customer, then you should contact our support team who
>> will be very happy to assist.
>>
>> > Third party configured the CLVM/GFS2. I'd like to make sure that
>> > distributed locking works OK.
>> > What are my options for verifying this?
>> >
>> I think we need to verify which type of locking the application uses
>> before we can answer this,
>>
>> Steve.
>>
>> > Thanks in advance!
>> >
>> > Regards,
>> > Stevo.
>> > --
>> > Linux-cluster mailing list
>> > Linux-cluster at redhat.com
>> > https://www.redhat.com/mailman/listinfo/linux-cluster
>>
>>
>> --
>> 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/20120105/28394ef5/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lock-file.c
Type: text/x-csrc
Size: 1433 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/linux-cluster/attachments/20120105/28394ef5/attachment.bin>


More information about the Linux-cluster mailing list