virtio: reenable config if freezing device failed
authorDavid Hildenbrand <david@redhat.com>
Tue, 13 Feb 2024 13:54:25 +0000 (14:54 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 19 Mar 2024 06:45:49 +0000 (02:45 -0400)
Currently, we don't reenable the config if freezing the device failed.

For example, virtio-mem currently doesn't support suspend+resume, and
trying to freeze the device will always fail. Afterwards, the device
will no longer respond to resize requests, because it won't get notified
about config changes.

Let's fix this by re-enabling the config if freezing fails.

Fixes: 22b7050a024d ("virtio: defer config changed notifications")
Cc: <stable@kernel.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20240213135425.795001-1-david@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/virtio/virtio.c

index f4080692b3513bd67a6d946c355c2cfbd7496ecd..f513ee21b1c182fc90859fdb9d0a9b47fc4e9442 100644 (file)
@@ -510,8 +510,10 @@ int virtio_device_freeze(struct virtio_device *dev)
 
        if (drv && drv->freeze) {
                ret = drv->freeze(dev);
-               if (ret)
+               if (ret) {
+                       virtio_config_enable(dev);
                        return ret;
+               }
        }
 
        if (dev->config->destroy_avq)