[PATCH 1/1][SRU][B/aws, F/aws, G/aws] UBUNTU: SAUCE: xen-netfront: prevent unnecessary close on hibernate

Andrea Righi andrea.righi at canonical.com
Fri Dec 4 16:12:18 UTC 2020


BugLink: https://bugs.launchpad.net/bugs/1906850

If the device in the Xen bus is already in the "closed" state when
hibernating there's no need to close the bus again. Doing so can only
cause errors that would prevent the system to hibernate correctly.

Signed-off-by: Andrea Righi <andrea.righi at canonical.com>
---
 drivers/net/xen-netfront.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 2d4f43522581..8462eefbf714 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1843,6 +1843,9 @@ static int netfront_freeze(struct xenbus_device *dev)
 
 	netif_device_detach(info->netdev);
 
+	if (dev->state == XenbusStateClosed)
+		goto closed;
+
 	info->freeze_state = NETIF_FREEZE_STATE_FREEZING;
 
 	/* Kick the backend to disconnect */
@@ -1859,7 +1862,7 @@ static int netfront_freeze(struct xenbus_device *dev)
 				 "the device may become inconsistent state");
 		return err;
 	}
-
+closed:
 	/* Tear down queues */
 	xennet_disconnect_backend(info);
 	xennet_destroy_queues(info);
-- 
2.29.2




More information about the kernel-team mailing list