Skip to content

Commit f55c318

Browse files
Paul Durrantdavem330
authored andcommitted
xen-netback: switch state to InitWait at the end of netback_probe()...
...as the comment above the function states. The switch to Initialising at the start of the function is somewhat bogus as the toolstack will have set that initial state anyway. To behave correctly, a backend should switch to InitWait once it has set up all xenstore values that may be required by a initialising frontend. This patch calls backend_switch_state() to make the transition at the appropriate point. NOTE: backend_switch_state() ignores errors from xenbus_switch_state() and so this patch removes an error path from netback_probe(). This means a failure to change state at this stage (in the absence of other failures) will leave the device instantiated. This is highly unlikley to happen as a failure to change state would indicate a failure to write to xenstore, and that will trigger other error paths. Also, a 'stuck' device can still be cleaned up using 'unbind' in any case. Signed-off-by: Paul Durrant <[email protected]> Acked-by: Wei Liu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 92fbeb4 commit f55c318

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/net/xen-netback/xenbus.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -992,11 +992,6 @@ static int netback_probe(struct xenbus_device *dev,
992992
be->dev = dev;
993993
dev_set_drvdata(&dev->dev, be);
994994

995-
be->state = XenbusStateInitialising;
996-
err = xenbus_switch_state(dev, XenbusStateInitialising);
997-
if (err)
998-
goto fail;
999-
1000995
sg = 1;
1001996

1002997
do {
@@ -1098,6 +1093,8 @@ static int netback_probe(struct xenbus_device *dev,
10981093
if (err)
10991094
pr_debug("Error writing feature-ctrl-ring\n");
11001095

1096+
backend_switch_state(be, XenbusStateInitWait);
1097+
11011098
script = xenbus_read(XBT_NIL, dev->nodename, "script", NULL);
11021099
if (IS_ERR(script)) {
11031100
err = PTR_ERR(script);

0 commit comments

Comments
 (0)