Bug 847848 - libvirt unlinks lockspace if sanlock daemon is unavilable
libvirt unlinks lockspace if sanlock daemon is unavilable
Product: Virtualization Tools
Classification: Community
Component: libvirt (Show other bugs)
All Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Libvirt Maintainers
Depends On:
  Show dependency treegraph
Reported: 2012-08-13 14:27 EDT by Asad Saeed
Modified: 2012-08-13 19:15 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-08-13 19:15:50 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch to fix issue (614 bytes, application/octet-stream)
2012-08-13 14:27 EDT, Asad Saeed
no flags Details

  None (edit)
Description Asad Saeed 2012-08-13 14:27:06 EDT
Created attachment 604066 [details]
Patch to fix issue

When in error case during lockspace creation, libvirt will delete the lockspace.  In a clustered environment, this completely broke the lock management and allowed vm's to be started on multiple nodes thereby causing corruption.

This was seen by running lsof -p `pidof sanlock` on all nodes.  Most of the nodes showed that they were accessing a deleted __LIBVIRT__DISKS__ file.

sanlock 26804 root    9u   REG               0,29  1048576   393228 /fs0/lock/sanlock/__LIBVIRT__DISKS__ (deleted)

Further investigation showed, the node that was not using an unlinked __LIBVIRT__DISKS__ space had in it's log

2012-08-07 19:44:18.029+0000: 18023: error : virLockManagerSanlockSetupLockspace:246 : Unable to add lockspace /fs0/lock/sanlock/__LIBVIRT__DISKS__: Operation now in progress

I've attached a patch that will not unlink lockspaces on sanlock daemon errors.

Version-Release number of selected component (if applicable):
This was reproduced with RHEL6.2 release libvirt-0.9.4-23.el6_2.9
Comment 1 Eric Blake 2012-08-13 14:39:11 EDT
Can you please also post your patch upstream to libvir-list@redhat.com, so it will get reviewed faster?
Comment 2 Eric Blake 2012-08-13 19:15:50 EDT
Will be in 0.10.0:

commit ff73c6d3bc60eb6557fedd12f14b8416c81fcda6
Author: Asad Saeed <asad.saeed@acidseed.com>
Date:   Mon Aug 13 13:21:10 2012 -0700

    sanlock: don't unlink lockspace if registration fails
    This is a patch for bug 847848
    If registering an existing lockspace with the sanlock daemon
    returns an error, libvirt should not proceed to unlink the lockspace.
    Signed-off-by: Asad Saeed <asad.saeed@acidseed.com>

Note You need to log in before you can comment on or make changes to this bug.