[Ocfs2-users] ocfs2 dlm configure

Herbert van den Bergh herbert.van.den.bergh at oracle.com
Sat Jul 1 13:37:54 PDT 2017


Heiko,

OCFS2 supports POSIX file locking.  You can use the perl flock function 
to acquire a lock on a file.  Only one node will be able to acquire the 
lock.  Other nodes that call flock on the same file will block if the 
operation parameter is not compatible, or flock will return an error 
immediately if the LOCK_NB bit is set in the operation parameter.  Take 
a look at man perlfunc, search for LOCK_NB.

Note that the lock is an "advisory lock", meaning that it doesn't 
prevent another process from opening and changing the file, it just 
prevents another incompatible flock from acquiring the lock. So this 
will only protect the file if all users of the file call flock before 
changing it.  That includes any tools that manipulate the vm image in 
your case.

Thanks,
Herbert.


On 07/01/2017 10:05 AM, Heiko L. wrote:
> Hallo,
>
>
> I have 2 ocfs-nodes that mount disk from san.
> Howto  configure lockmanager to open a (vm-image-)file excluxive?
>
> I have written a script "chk_dlm.pl" which should print a errormsg on node2,
> if running script at the same time.
>
> node1:/mnt/xenimg/test $ ~/bin/chk_dlm.pl testfile
> 3159 open file testfile
> 3175 close file testfile
> node2:/mnt/xenimg/test $ ~/bin/chk_dlm.pl testfile
> 3162 open file testfile
> 3177 close file testfile
>
> but i can open file for rw on both nodes.
>
> What can i do?
>
>
> regards heiko
>
> [1] http://www-home.fh-lausitz.de/~hlehmann/tmp/17/chk_dlm.pl-170629
>
>
>
>
> _______________________________________________
> Ocfs2-users mailing list
> Ocfs2-users at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-users




More information about the Ocfs2-users mailing list