diff mbox series

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

Message ID 20201204161218.291075-2-andrea.righi@canonical.com
State New
Headers show
Series [1/1,SRU,B/aws,F/aws,G/aws] UBUNTU: SAUCE: xen-netfront: prevent unnecessary close on hibernate | expand

Commit Message

Andrea Righi Dec. 4, 2020, 4:12 p.m. UTC
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@canonical.com>
---
 drivers/net/xen-netfront.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Ian May Dec. 17, 2020, 7:04 p.m. UTC | #1
Applied to:
  bionic/linux-aws
  focal/linux-aws
  groovy/linux-aws

Thanks,
Ian

On 2020-12-04 17:12:18 , Andrea Righi wrote:
> 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@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
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox series

Patch

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);