Skip to contentSkip to conversation

xen-netback: only remove 'hotplug-status' when the vif is actually destroyed

PATCH Applied Paul Durrant 3 participants 3 messages Sep 1, 2022 – Sep 14, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen-netback: only remove 'hotplug-status' when the vif is actually destroyed

Removing 'hotplug-status' in backend_disconnected() means that it will be removed even in the case that the frontend unilaterally disconnects (which it is free to do at any time). The consequence of this is that, when the frontend attempts to re-connect, the backend gets stuck in 'InitWait' rather than moving straight to 'Connected' (which it can do because the hotplug script has already run).
Instead, the 'hotplug-status' mode should be removed in netback_remove() i.e. when the vif really is going away.

Fixes 0f4558ae9187 ("Revert "xen-netback: remove 'hotplug-status' once it has served its purpose"")

---
Cc: Wei Liu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: "Marek Marczykowski-Górecki" <[email protected]>

---
 drivers/net/xen-netback/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/xenbus.c +1 -1
index 990360d75cb6..e85b3c5d4acc 100644
@@ -256,7 +256,6 @@ static void backend_disconnect(struct backend_info *be)
 		unsigned int queue_index;
 
 		xen_unregister_watchers(vif);
-		xenbus_rm(XBT_NIL, be->dev->nodename, "hotplug-status");
 #ifdef CONFIG_DEBUG_FS
 		xenvif_debugfs_delif(vif);
 #endif /* CONFIG_DEBUG_FS */
@@ -984,6 +983,7 @@ static int netback_remove(struct xenbus_device *dev)
 	struct backend_info *be = dev_get_drvdata(&dev->dev);
 
 	unregister_hotplug_status_watch(be);
+	xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status");
 	if (be->vif) {
 		kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
 		backend_disconnect(be);
Signature · 1 line
2.20.1
#1 lore raw
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 10 lines · On Thu, 1 Sep 2022 12:55:54 +0100 you wrote:

Removing 'hotplug-status' in backend_disconnected() means that it will be removed even in the case that the frontend unilaterally disconnects (which it is free to do at any time). The consequence of this is that, when the frontend attempts to re-connect, the backend gets stuck in 'InitWait' rather than moving straight to 'Connected' (which it can do because the hotplug script has already run).
Instead, the 'hotplug-status' mode should be removed in netback_remove() i.e. when the vif really is going away.

[...]

Here is the summary with links:
- [net] xen-netback: only remove 'hotplug-status' when the vif is actually destroyed

    https://git.kernel.org/netdev/net/c/c55f34b6aec2

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Reviewed-by on v1 1/1
#2 lore raw
In reply to Paul Durrant
Quoted 11 lines · Paul Durrant

Removing 'hotplug-status' in backend_disconnected() means that it will be removed even in the case that the frontend unilaterally disconnects (which it is free to do at any time). The consequence of this is that, when the frontend attempts to re-connect, the backend gets stuck in 'InitWait' rather than moving straight to 'Connected' (which it can do because the hotplug script has already run).
Instead, the 'hotplug-status' mode should be removed in netback_remove() i.e. when the vif really is going away.

Fixes 0f4558ae9187 ("Revert "xen-netback: remove 'hotplug-status' once it has served its purpose"")

Juergen