Skip to contentSkip to conversation

: Fix blkfront to accept expanded devices v2

PATCH New Chris Lalancette 1 participant 1 message Jun 25, 2008 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 : Fix blkfront to accept expanded devices v2

This patch implements the new extended allocation scheme on the blkfront end. Note that there is a new xenbus node for the extended stuff, called "virtual-device-ext". On a blkfront_probe(), if nothing is found in "virtual-device", then it will go looking in "virtual-device-ext". This prevents old guest kernels from potentially mis-interpreting data in "virtual-device" (and then subsequently crashing).

Changes since v1:
- Restructure the changes to remove duplicate code
- Add some error checks on the xlvbd_add() path. Note that I did not do full error checking on the existing numbering scheme (i.e. the 202<<8 for xvd, 3<<8 for IDE, 8<<8 for SCSI, etc). The reason I didn't do full checking is that it is perfectly legal to do something like: "xm block-attach pv tap:aio:/disk 0xCB10 w" (which is major 203), which then maps onto the 202 xvd device. It's not particularly nice behavior, in my opinion, but changing it now would change this behavior. So the only check I added was to make sure we weren't above the extended device range (1<<28).

drivers/xen/blkfront/blkfront.c +7 -2
diff -r 5201a184f513 drivers/xen/blkfront/blkfront.c
@@ -92,8 +92,13 @@ static int blkfront_probe(struct xenbus_
 	err = xenbus_scanf(XBT_NIL, dev->nodename,
 			   "virtual-device", "%i", &vdevice);
 	if (err != 1) {
-		xenbus_dev_fatal(dev, err, "reading virtual-device");
-		return err;
+		/* go looking in the extended area instead */
+		err = xenbus_scanf(XBT_NIL, dev->nodename, "virtual-device-ext",
+			"%i", &vdevice);
+		if (err != 1) {
+			xenbus_dev_fatal(dev, err, "reading virtual-device");
+			return err;
+		}
 	}
 
 	info = kzalloc(sizeof(*info), GFP_KERNEL);
drivers/xen/blkfront/vbd.c +36 -14

102 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel