ia64/xen-unstable

changeset 7594:a7129a40f239

From Gerd Knorr <kraxel@suse.de>:

Watch events may get lost, the xenstored response races against the new
watch being added to the watch list in register_xenbus_watch(). Fixed
by adding the watch to the list unconditionally, and remove it in the
error case.

That one fixes the network issues I'm seeing. Due to the race the
"online" hotplug event for the vif backend was lost sometimes.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Mon Oct 31 17:03:13 2005 +0100 (2005-10-31)
parents 00377595e4f9
children 286946489e5d
files linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Mon Oct 31 17:01:31 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Mon Oct 31 17:03:13 2005 +0100
     1.3 @@ -682,14 +682,15 @@ int register_xenbus_watch(struct xenbus_
     1.4  
     1.5  	spin_lock(&watches_lock);
     1.6  	BUG_ON(find_watch(token));
     1.7 +	list_add(&watch->list, &watches);
     1.8  	spin_unlock(&watches_lock);
     1.9  
    1.10  	err = xs_watch(watch->node, token);
    1.11  
    1.12  	/* Ignore errors due to multiple registration. */
    1.13 -	if ((err == 0) || (err == -EEXIST)) {
    1.14 +	if ((err != 0) && (err != -EEXIST)) {
    1.15  		spin_lock(&watches_lock);
    1.16 -		list_add(&watch->list, &watches);
    1.17 +		list_del(&watch->list);
    1.18  		spin_unlock(&watches_lock);
    1.19  	}
    1.20