Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two SLES 11 servers that are SAN attached to a Clarion CX-340. The SAN partition has been formatted with ocfs2 and I have both machines setup in a cluster and the cluster is running (all appears to be normal). I have a small java application as a locking test and when I run the application on both machines at the same time, I should get the lock on one server and the other should refuse the lock since the first already holds a lock on that file but in this case both servers get a lock on the same file.

Basically my cluster.conf looks like this:

              ip_port = 7777
              ip_address =
              number = 1
              name = osrsles10node1
              cluster = osrsles10
              ip_port = 7777
              ip_address =
              number = 2
              name = osrsles10node2
              cluster = osrsles10
              node_count = 2
              name = osrsles10

Please ask for any other info - I really need these locks to be exclusive to each server.


share|improve this question

What type of locking are you using? flock(2), fcntl(2)? If you're not sure, you can run your Java app under strace to find out.

OCFS2 only supports cluster-wide flock - not fcntl.

share|improve this answer
and if I was using fcntl how would I switch to flock? – Autobyte May 19 '10 at 14:02
I'm not at all familiar with how Java does locking but in C/perl/python you simply call the appropriate flock() function rather than fcntl() – James May 19 '10 at 21:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.