ia64/xen-unstable

changeset 8008:fc41a9c9bc36

Inside xenbus_switch_state, don't write the new state if the node has already
disappeared. This happens when the driver is being torn down, and we don't
want to resurrect the device directory in the store because of it.

Partially addresses bug #424.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Wed Nov 23 18:47:54 2005 +0000 (2005-11-23)
parents fb42478203b9
children e48bb8550f95
files linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c	Wed Nov 23 18:45:57 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c	Wed Nov 23 18:47:54 2005 +0000
     1.3 @@ -97,14 +97,17 @@ int xenbus_switch_state(struct xenbus_de
     1.4  	/* We check whether the state is currently set to the given value, and
     1.5  	   if not, then the state is set.  We don't want to unconditionally
     1.6  	   write the given state, because we don't want to fire watches
     1.7 -	   unnecessarily.
     1.8 +	   unnecessarily.  Furthermore, if the node has gone, we don't write
     1.9 +	   to it, as the device will be tearing down, and we don't want to
    1.10 +	   resurrect that directory.
    1.11  	 */
    1.12  
    1.13  	int current_state;
    1.14  
    1.15  	int err = xenbus_scanf(xbt, dev->nodename, "state", "%d",
    1.16  			       &current_state);
    1.17 -	if (err == 1 && (XenbusState)current_state == state)
    1.18 +	if ((err == 1 && (XenbusState)current_state == state) ||
    1.19 +	    err == -ENOENT)
    1.20  		return 0;
    1.21  
    1.22  	err = xenbus_printf(xbt, dev->nodename, "state", "%d", state);