ia64/linux-2.6.18-xen.hg

changeset 909:865707f40531

xenbus: fix timeout with PV guest and physical CDROM

Specifying a physical CDROM in the configuration of a PV guest, like

disk =3D ['tap:aio:/....,xvda,w', 'phy:/dev/cdrom,hdc:cdrom,r' ]

will cause the 300 seconds timeout to occur if there is no physical
CDROM in the tray. The bug is due to the device being Closed (as shown by
the timeout message) but not ready. The configuration is quite bogus, but
this is a regression from when the timeout was 10 seconds only, and
the fix is easy and safe: only check is_ready for connected devices.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jun 23 11:12:38 2009 +0100 (2009-06-23)
parents baeb818cd2dc
children 5bb4e5dd1abc
files drivers/xen/xenbus/xenbus_probe.c
line diff
     1.1 --- a/drivers/xen/xenbus/xenbus_probe.c	Thu Jun 18 10:32:16 2009 +0100
     1.2 +++ b/drivers/xen/xenbus/xenbus_probe.c	Tue Jun 23 11:12:38 2009 +0100
     1.3 @@ -1108,7 +1108,7 @@ int xenbus_init(void)
     1.4  }
     1.5  #endif
     1.6  
     1.7 -static int is_disconnected_device(struct device *dev, void *data)
     1.8 +static int is_device_connecting(struct device *dev, void *data)
     1.9  {
    1.10  	struct xenbus_device *xendev = to_xenbus_device(dev);
    1.11  	struct device_driver *drv = data;
    1.12 @@ -1127,15 +1127,16 @@ static int is_disconnected_device(struct
    1.13  
    1.14  	xendrv = to_xenbus_driver(dev->driver);
    1.15  	return (xendev->state < XenbusStateConnected ||
    1.16 -		(xendrv->is_ready && !xendrv->is_ready(xendev)));
    1.17 +		(xendev->state == XenbusStateConnected &&
    1.18 +		 xendrv->is_ready && !xendrv->is_ready(xendev)));
    1.19  }
    1.20  
    1.21 -static int exists_disconnected_device(struct device_driver *drv)
    1.22 +static int exists_connecting_device(struct device_driver *drv)
    1.23  {
    1.24  	if (xenbus_frontend.error)
    1.25  		return xenbus_frontend.error;
    1.26  	return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv,
    1.27 -				is_disconnected_device);
    1.28 +				is_device_connecting);
    1.29  }
    1.30  
    1.31  static int print_device_status(struct device *dev, void *data)
    1.32 @@ -1198,7 +1199,7 @@ static void wait_for_devices(struct xenb
    1.33  	if (!ready_to_wait_for_devices || !is_running_on_xen())
    1.34  		return;
    1.35  
    1.36 -	while (exists_disconnected_device(drv)) {
    1.37 +	while (exists_connecting_device(drv)) {
    1.38  		if (time_after(jiffies, start + (seconds_waited+5)*HZ)) {
    1.39  			if (!seconds_waited)
    1.40  				printk(KERN_WARNING "XENBUS: Waiting for "