[Linux-cluster] DLM user API for lock value block

Jean-Marc Saffroy saffroy at gmail.com
Tue Dec 6 16:18:44 UTC 2016


I am trying to use the DLM userland API (libdlm3), and while I was able to 
do plain lock acquisitions and conversions, I am stuck trying to update 
and then read the lock value block.

Does anyone have working examples of this? I did look at the rhdlmbook 
doc, but couldn't fine one.

Attached is a messy test I wrote, which fails because it looks like 
up-converting a lock with the LKF_VALBLK set doesn't seem to overwrite the 
buffer I provide for the lock value block (and with strace it looks like 
the kernel device returns the LVB on a down-conversion! weird). Example 
output below.


saffroy at gmail.com

$ make D=1
gcc -D_REENTRANT -Wall -Werror   -O0 -g    locklvb.c  -pthread -ldlm 
-lpthread   -o locklvb

$ ./locklvb 
dlm_kernel_version 6.0.1
create_lockspace: Operation not permitted
acquiring NL on MyLock...
LOCK mode -> NL convert 0
read_lvb 0 write_lvb 0
completion ast
entering loop on lock #1
count 0
LOCK mode -> PW convert 1
read_lvb 0 write_lvb 0
completion ast
init lvb => 51
lvb cache => 52
LOCK mode -> CR convert 1
read_lvb 0 write_lvb 1
completion ast
count 1
LOCK mode -> PW convert 1
read_lvb 1 write_lvb 0
completion ast
read lvb -1
locklvb: locklvb.c:177: do_lock: Assertion `lvb_lock.val >= 0' failed.
Aborted (core dumped)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: locklvb.c
Type: text/x-csrc
Size: 8573 bytes
URL: <http://listman.redhat.com/archives/linux-cluster/attachments/20161206/64fd2e0b/attachment.bin>

More information about the Linux-cluster mailing list