The commit is pushed to "branch-rh10-6.12.0-211.16.1.12.x.vz10-ovz" and will 
appear at [email protected]:openvz/vzkernel.git
after rh10-6.12.0-211.16.1.12.7.vz10
------>
commit 7afd087ad188ae14d43010fe3a578219bbab2d66
Author: Denis V. Lunev <[email protected]>
Date:   Mon Jun 29 14:34:54 2026 +0200

    virtio_balloon: factor out virtballoon_quiesce()
    
    virtballoon_remove() stops all of the balloon's asynchronous work (the
    free page reporting worker, the inflate/deflate and stats workers, the
    OOM notifier and the free page shrinker) before tearing the device
    down. A following change needs the same teardown from a .shutdown
    handler, so move it into a virtballoon_quiesce() helper.
    
    No functional change.
    
    Feature: fix ms/virtio_balloon
    https://virtuozzo.atlassian.net/browse/VSTOR-135654
    Signed-off-by: Denis V. Lunev <[email protected]>
    
    Reviewed-by: David Hildenbrand <[email protected]>
---
 drivers/virtio/virtio_balloon.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index daa335e81c4df..f16c8ed6737df 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -1177,27 +1177,41 @@ static void remove_common(struct virtio_balloon *vb)
        vb->vdev->config->del_vqs(vb->vdev);
 }
 
-static void virtballoon_remove(struct virtio_device *vdev)
+/*
+ * Stop all asynchronous balloon work. The device must still be alive so that
+ * in-flight requests can drain via the host before it is reset or freed.
+ */
+static void virtballoon_quiesce(struct virtio_balloon *vb)
 {
-       struct virtio_balloon *vb = vdev->priv;
+       struct virtio_device *vdev = vb->vdev;
 
-       virtio_balloon_debugfs_exit(vb);
-       if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_REPORTING))
+       if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_REPORTING))
                page_reporting_unregister(&vb->pr_dev_info);
-       if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
+       if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
                unregister_oom_notifier(&vb->oom_nb);
-       if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT))
+       if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT))
                virtio_balloon_unregister_shrinker(vb);
+
        spin_lock_irq(&vb->stop_update_lock);
        vb->stop_update = true;
        spin_unlock_irq(&vb->stop_update_lock);
        cancel_work_sync(&vb->update_balloon_size_work);
        cancel_work_sync(&vb->update_balloon_stats_work);
 
-       if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) {
+       if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT))
                cancel_work_sync(&vb->report_free_page_work);
+}
+
+static void virtballoon_remove(struct virtio_device *vdev)
+{
+       struct virtio_balloon *vb = vdev->priv;
+
+       virtio_balloon_debugfs_exit(vb);
+
+       virtballoon_quiesce(vb);
+
+       if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT))
                destroy_workqueue(vb->balloon_wq);
-       }
 
        remove_common(vb);
        kfree(vb);
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to