Patch "virtio-mem: convert most offline_and_remove_memory() errors to -EBUSY" has been added to the 6.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    virtio-mem: convert most offline_and_remove_memory() errors to -EBUSY

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     virtio-mem-convert-most-offline_and_remove_memory-er.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f29b1fddea9f41f68233183a2f7c03998ee7e9fc
Author: David Hildenbrand <david@xxxxxxxxxx>
Date:   Thu Jul 13 16:55:49 2023 +0200

    virtio-mem: convert most offline_and_remove_memory() errors to -EBUSY
    
    [ Upstream commit ddf409851461f515cc32974714b73efe2e012bde ]
    
    Just like we do with alloc_contig_range(), let's convert all unknown
    errors to -EBUSY, but WARN so we can look into the issue. For example,
    offline_pages() could fail with -EINTR, which would be unexpected in our
    case.
    
    Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
    Message-Id: <20230713145551.2824980-3-david@xxxxxxxxxx>
    Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
index ed15d2a4bd96b..1a76ba2bc118c 100644
--- a/drivers/virtio/virtio_mem.c
+++ b/drivers/virtio/virtio_mem.c
@@ -741,11 +741,15 @@ static int virtio_mem_offline_and_remove_memory(struct virtio_mem *vm,
 		 * immediately instead of waiting.
 		 */
 		virtio_mem_retry(vm);
-	} else {
-		dev_dbg(&vm->vdev->dev,
-			"offlining and removing memory failed: %d\n", rc);
+		return 0;
 	}
-	return rc;
+	dev_dbg(&vm->vdev->dev, "offlining and removing memory failed: %d\n", rc);
+	/*
+	 * We don't really expect this to fail, because we fake-offlined all
+	 * memory already. But it could fail in corner cases.
+	 */
+	WARN_ON_ONCE(rc != -ENOMEM && rc != -EBUSY);
+	return rc == -ENOMEM ? -ENOMEM : -EBUSY;
 }
 
 /*



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux