
I compiled and tested the patch, and the release of the resource looks fine now. Only the specific resource/disk is being removed from sanlock now, while the others stay registered.
Hold on, despite the behavior is as expected with the patch, there seems to be an issue with the return value or check: 2012-07-09 10:53:29.105+0000: 6686: debug : virLockManagerAddResource:320 : lock=0x7f22e8009b60 type=0 name=/var/lib/libvirt/images/testlun2.img nparams=0 params=(nil) flags=0 2012-07-09 10:53:29.105+0000: 6686: debug : virLockManagerRelease:352 : lock=0x7f22e8009b60 state=(nil) flags=0 2012-07-09 10:53:29.105+0000: 6686: error : virLockManagerSanlockRelease:842 : Failed to release lock: Operation not permitted 2012-07-09 10:53:29.105+0000: 6686: debug : virLockManagerFree:374 : lock=0x7f22e8009b60 2012-07-09 10:53:29.105+0000: 6686: warning : qemuDomainDetachPciDiskDevice:1356 : Unable to release lock on /var/lib/libvirt/images/testlun2.img The disk resource is however removed from the domain, and from sanlock (as exposed with: sanlock client status) as we expected it to be. Probably something is missing in the return value handling. Fyi, Frido