Bug 847848 - libvirt unlinks lockspace if sanlock daemon is unavilable
Summary: libvirt unlinks lockspace if sanlock daemon is unavilable
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-08-13 18:27 UTC by Asad Saeed
Modified: 2012-08-13 23:15 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-08-13 23:15:50 UTC
Embargoed:


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

Description Asad Saeed 2012-08-13 18:27:06 UTC
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 18:39:11 UTC
Can you please also post your patch upstream to libvir-list, so it will get reviewed faster?

Comment 2 Eric Blake 2012-08-13 23:15:50 UTC
Will be in 0.10.0:

commit ff73c6d3bc60eb6557fedd12f14b8416c81fcda6
Author: Asad Saeed <asad.saeed>
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>


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