]> git.baikalelectronics.ru Git - kernel.git/commit
xen-netback: Check for hotplug-status existence before watching
authorMichael Brown <mbrown@fensystems.co.uk>
Tue, 13 Apr 2021 15:25:12 +0000 (16:25 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Apr 2021 22:24:14 +0000 (15:24 -0700)
commitaea2c5f95bf1e0546f1172d63570effba2928a87
tree68d755c22e5a1ebea73397b4e1d958f88adb16a2
parent291537dd8676e9118bd930c840355f81883d7809
xen-netback: Check for hotplug-status existence before watching

The logic in connect() is currently written with the assumption that
xenbus_watch_pathfmt() will return an error for a node that does not
exist.  This assumption is incorrect: xenstore does allow a watch to
be registered for a nonexistent node (and will send notifications
should the node be subsequently created).

As of commit ee7e4850f ("xen-netback: remove 'hotplug-status' once it
has served its purpose"), this leads to a failure when a domU
transitions into XenbusStateConnected more than once.  On the first
domU transition into Connected state, the "hotplug-status" node will
be deleted by the hotplug_status_changed() callback in dom0.  On the
second or subsequent domU transition into Connected state, the
hotplug_status_changed() callback will therefore never be invoked, and
so the backend will remain stuck in InitWait.

This failure prevents scenarios such as reloading the xen-netfront
module within a domU, or booting a domU via iPXE.  There is
unfortunately no way for the domU to work around this dom0 bug.

Fix by explicitly checking for existence of the "hotplug-status" node,
thereby creating the behaviour that was previously assumed to exist.

Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/xen-netback/xenbus.c