Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

      node:
              ip_port = 7777
              ip_address = 192.168.10.121
              number = 1
              name = osrsles10node1
              cluster = osrsles10
      node:
              ip_port = 7777
              ip_address = 192.168.10.122
              number = 2
              name = osrsles10node2
              cluster = osrsles10
      cluster:
              node_count = 2
              name = osrsles10

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

Thanks.

share|improve this question
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.