1

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.

Autobyte
  • 171
  • 3
  • 8

1 Answers1

1

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.

James
  • 7,643
  • 2
  • 24
  • 33
  • 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