[libvirt] [PATCH] Release only specific sanlock resource

This is a patch for bug 826704 All sanlock resources get released when hot-dettaching a disk from the domain because virLockManagerSanlockRelease uses the wrong function parameters/flags. With the patch only the resources that should be released are cleaned up. Signed-off-by: Frido Roose <frido.roose@gmail.com> --- src/locking/lock_driver_sanlock.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c index 7c71af3..0625d09 100644 --- a/src/locking/lock_driver_sanlock.c +++ b/src/locking/lock_driver_sanlock.c @@ -814,7 +814,7 @@ static int virLockManagerSanlockRelease(virLockManagerPtr lock, unsigned int flags) { virLockManagerSanlockPrivatePtr priv = lock->privateData; - int res_count; + int res_count=priv->res_count; int rv; virCheckFlags(0, -1); @@ -834,7 +834,7 @@ static int virLockManagerSanlockRelease(virLockManagerPtr lock, VIR_FREE(*state); } - if ((rv = sanlock_release(-1, priv->vm_pid, SANLK_REL_ALL, 0, NULL)) < 0) { + if ((rv = sanlock_release(-1, priv->vm_pid, 0, res_count, priv->res_args)) < 0) { if (rv <= -200) virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to release lock: error %d"), rv); -- 1.7.1

On 08/13/2012 04:54 AM, Frido Roose wrote:
This is a patch for bug 826704 All sanlock resources get released when hot-dettaching a disk from the domain because virLockManagerSanlockRelease uses the wrong function parameters/flags. With the patch only the resources that should be released are cleaned up.
Signed-off-by: Frido Roose <frido.roose@gmail.com> --- src/locking/lock_driver_sanlock.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c index 7c71af3..0625d09 100644 --- a/src/locking/lock_driver_sanlock.c +++ b/src/locking/lock_driver_sanlock.c @@ -814,7 +814,7 @@ static int virLockManagerSanlockRelease(virLockManagerPtr lock, unsigned int flags) { virLockManagerSanlockPrivatePtr priv = lock->privateData; - int res_count; + int res_count=priv->res_count;
Coding style: space on both sides of '='
@@ -834,7 +834,7 @@ static int virLockManagerSanlockRelease(virLockManagerPtr lock, VIR_FREE(*state); }
- if ((rv = sanlock_release(-1, priv->vm_pid, SANLK_REL_ALL, 0, NULL)) < 0) { + if ((rv = sanlock_release(-1, priv->vm_pid, 0, res_count, priv->res_args)) < 0) {
I'm not as familiar with the sanlock code to know if this is the right fix, but if Dan hasn't reviewed this in a couple more days, give me a ping and I'll learn something new. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Mon, Aug 13, 2012 at 12:54:38PM +0200, Frido Roose wrote:
This is a patch for bug 826704 All sanlock resources get released when hot-dettaching a disk from the domain because virLockManagerSanlockRelease uses the wrong function parameters/flags. With the patch only the resources that should be released are cleaned up.
Signed-off-by: Frido Roose <frido.roose@gmail.com> --- src/locking/lock_driver_sanlock.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c index 7c71af3..0625d09 100644 --- a/src/locking/lock_driver_sanlock.c +++ b/src/locking/lock_driver_sanlock.c @@ -814,7 +814,7 @@ static int virLockManagerSanlockRelease(virLockManagerPtr lock, unsigned int flags) { virLockManagerSanlockPrivatePtr priv = lock->privateData; - int res_count; + int res_count=priv->res_count; int rv;
virCheckFlags(0, -1); @@ -834,7 +834,7 @@ static int virLockManagerSanlockRelease(virLockManagerPtr lock, VIR_FREE(*state); }
- if ((rv = sanlock_release(-1, priv->vm_pid, SANLK_REL_ALL, 0, NULL)) < 0) { + if ((rv = sanlock_release(-1, priv->vm_pid, 0, res_count, priv->res_args)) < 0) { if (rv <= -200) virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to release lock: error %d"), rv);
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 08/13/2012 10:17 AM, Daniel P. Berrange wrote:
On Mon, Aug 13, 2012 at 12:54:38PM +0200, Frido Roose wrote:
This is a patch for bug 826704 All sanlock resources get released when hot-dettaching a disk from the domain because virLockManagerSanlockRelease uses the wrong function parameters/flags. With the patch only the resources that should be released are cleaned up.
ACK
Pushed with the formatting fixed. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 08/13/2012 10:29 AM, Eric Blake wrote:
On 08/13/2012 10:17 AM, Daniel P. Berrange wrote:
On Mon, Aug 13, 2012 at 12:54:38PM +0200, Frido Roose wrote:
This is a patch for bug 826704 All sanlock resources get released when hot-dettaching a disk from the domain because virLockManagerSanlockRelease uses the wrong function parameters/flags. With the patch only the resources that should be released are cleaned up.
ACK
Pushed with the formatting fixed.
I also added you to AUTHORS, to keep 'make syntax-check' happy; let me know if you prefer any alternate spellings to name or email. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Daniel P. Berrange
-
Eric Blake
-
Frido Roose