Skip to content

Commit 8ab0144

Browse files
Bob Liukonradwilk
authored andcommitted
driver: xen-blkfront: move talk_to_blkback to a more suitable place
The major responsibility of talk_to_blkback() is allocate and initialize the request ring and write the ring info to xenstore. But this work should be done after backend entered 'XenbusStateInitWait' as defined in the protocol file. See xen/include/public/io/blkif.h in XEN git tree: Front Back ================================= ===================================== XenbusStateInitialising XenbusStateInitialising o Query virtual device o Query backend device identification properties. data. o Setup OS device instance. o Open and validate backend device. o Publish backend features and transport parameters. | | V XenbusStateInitWait o Query backend features and transport parameters. o Allocate and initialize the request ring. There is no problem with this yet, but it is an violation of the design and furthermore it would not allow frontend/backend to negotiate 'multi-page' and 'multi-queue' features. Changes in v2: - Re-write the commit message to be more clear. Signed-off-by: Bob Liu <bob.liu@oracle.com> Acked-by: Roger Pau Monné <roger.pau@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
1 parent 69b91ed commit 8ab0144

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/block/xen-blkfront.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,13 +1430,6 @@ static int blkfront_probe(struct xenbus_device *dev,
14301430
info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0);
14311431
dev_set_drvdata(&dev->dev, info);
14321432

1433-
err = talk_to_blkback(dev, info);
1434-
if (err) {
1435-
kfree(info);
1436-
dev_set_drvdata(&dev->dev, NULL);
1437-
return err;
1438-
}
1439-
14401433
return 0;
14411434
}
14421435

@@ -1906,8 +1899,13 @@ static void blkback_changed(struct xenbus_device *dev,
19061899
dev_dbg(&dev->dev, "blkfront:blkback_changed to state %d.\n", backend_state);
19071900

19081901
switch (backend_state) {
1909-
case XenbusStateInitialising:
19101902
case XenbusStateInitWait:
1903+
if (talk_to_blkback(dev, info)) {
1904+
kfree(info);
1905+
dev_set_drvdata(&dev->dev, NULL);
1906+
break;
1907+
}
1908+
case XenbusStateInitialising:
19111909
case XenbusStateInitialised:
19121910
case XenbusStateReconfiguring:
19131911
case XenbusStateReconfigured:

0 commit comments

Comments
 (0)