direct-io.hg

changeset 8375:b62e324574d2

Split talk_to_otherend into two pieces, one for getting the otherend details,
and one for registering the watch on the otherend's path. This means that we
get the fix intended by xen-unstable changeset 8370:39a616126104 (i.e. we only
register the watch once drv->probe() has succeeded), but without breaking block
devices.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Thu Dec 15 18:38:49 2005 +0000 (2005-12-15)
parents bbe553187504
children 7e419ba80326 11cd619db035
files linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Thu Dec 15 13:55:05 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Thu Dec 15 18:38:49 2005 +0000
     1.3 @@ -315,15 +315,16 @@ static void otherend_changed(struct xenb
     1.4  static int talk_to_otherend(struct xenbus_device *dev)
     1.5  {
     1.6  	struct xenbus_driver *drv = to_xenbus_driver(dev->dev.driver);
     1.7 -	int err;
     1.8  
     1.9  	free_otherend_watch(dev);
    1.10  	free_otherend_details(dev);
    1.11  
    1.12 -	err = drv->read_otherend_details(dev);
    1.13 -	if (err)
    1.14 -		return err;
    1.15 +	return drv->read_otherend_details(dev);
    1.16 +}
    1.17  
    1.18 +
    1.19 +static int watch_otherend(struct xenbus_device *dev)
    1.20 +{
    1.21  	return xenbus_watch_path2(dev, dev->otherend, "state",
    1.22  				  &dev->otherend_watch, otherend_changed);
    1.23  }
    1.24 @@ -349,14 +350,22 @@ static int xenbus_dev_probe(struct devic
    1.25  		goto fail;
    1.26  	}
    1.27  
    1.28 +	err = talk_to_otherend(dev);
    1.29 +	if (err) {
    1.30 +		printk(KERN_WARNING
    1.31 +		       "xenbus_probe: talk_to_otherend on %s failed.\n",
    1.32 +		       dev->nodename);
    1.33 +		return err;
    1.34 +	}
    1.35 +
    1.36  	err = drv->probe(dev, id);
    1.37  	if (err)
    1.38  		goto fail;
    1.39  
    1.40 -	err = talk_to_otherend(dev);
    1.41 +	err = watch_otherend(dev);
    1.42  	if (err) {
    1.43  		printk(KERN_WARNING
    1.44 -		       "xenbus_probe: talk_to_otherend on %s failed.\n",
    1.45 +		       "xenbus_probe: watch_otherend on %s failed.\n",
    1.46  		       dev->nodename);
    1.47  		return err;
    1.48  	}
    1.49 @@ -826,6 +835,14 @@ static int resume_dev(struct device *dev
    1.50  		return err;
    1.51  	}
    1.52  
    1.53 +	err = watch_otherend(xdev);
    1.54 +	if (err) {
    1.55 +		printk(KERN_WARNING
    1.56 +		       "xenbus_probe: resume (watch_otherend) %s failed: "
    1.57 +		       "%d.\n", dev->bus_id, err);
    1.58 +		return err;
    1.59 +	}
    1.60 +
    1.61  	if (drv->resume)
    1.62  		err = drv->resume(xdev);
    1.63  	if (err)