From 46e2f885aff9109a873ba20dbd6a76d414721526 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Wed, 20 Feb 2019 14:55:12 +0000 Subject: [PATCH] devices: fix attach count for vhost-user-blk Commit affd6e3216cbcfe797c617f61138bda1a5e928b2 ("devices: add reference count for devices.") introduced an attach count for devices. The vhost-user-blk device increments the counter instead of decrementing it when detaching. Fixes: #1259 Signed-off-by: Stefan Hajnoczi --- virtcontainers/device/drivers/vhost_user_blk.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virtcontainers/device/drivers/vhost_user_blk.go b/virtcontainers/device/drivers/vhost_user_blk.go index cfc53d4145..a613abda82 100644 --- a/virtcontainers/device/drivers/vhost_user_blk.go +++ b/virtcontainers/device/drivers/vhost_user_blk.go @@ -56,7 +56,7 @@ func (device *VhostUserBlkDevice) Attach(devReceiver api.DeviceReceiver) (err er // Detach is standard interface of api.Device, it's used to remove device from some // DeviceReceiver func (device *VhostUserBlkDevice) Detach(devReceiver api.DeviceReceiver) error { - skip, err := device.bumpAttachCount(true) + skip, err := device.bumpAttachCount(false) if err != nil { return err }