direct-io.hg

changeset 11656:dc017943eea2

[XENBUS] Don't perform normal state-machine transitions and
notifications during shutdown. When rootfs goes away this can
cause the system to hang, as we notify userspace etc.
Instead we forcibly reset the state machine back to state Closed
if we are a frontend driver, to get the backend to release
resources. Necessary if we are going to kexec.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Fri Sep 29 09:14:28 2006 +0100 (2006-09-29)
parents d90be316e5f5
children 52bb01f36c8b
files linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Thu Sep 28 13:44:00 2006 -0700
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Fri Sep 29 09:14:28 2006 +0100
     1.3 @@ -273,7 +273,7 @@ static void backend_changed(struct xenbu
     1.4  			xenbus_dev_fatal(dev, -ENODEV, "bdget failed");
     1.5  
     1.6  		down(&bd->bd_sem);
     1.7 -		if (info->users > 0 && system_state == SYSTEM_RUNNING)
     1.8 +		if (info->users > 0)
     1.9  			xenbus_dev_error(dev, -EBUSY,
    1.10  					 "Device in use; refusing to close");
    1.11  		else
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Thu Sep 28 13:44:00 2006 -0700
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Fri Sep 29 09:14:28 2006 +0100
     2.3 @@ -322,6 +322,20 @@ static void otherend_changed(struct xenb
     2.4  	DPRINTK("state is %d (%s), %s, %s", state, xenbus_strstate(state),
     2.5  		dev->otherend_watch.node, vec[XS_WATCH_PATH]);
     2.6  
     2.7 +	/*
     2.8 +	 * Ignore xenbus transitions during shutdown. This prevents us doing
     2.9 +	 * work that can fail e.g., when the rootfs is gone.
    2.10 +	 */
    2.11 +	if (system_state > SYSTEM_RUNNING) {
    2.12 +		struct xen_bus_type *bus = bus;
    2.13 +		bus = container_of(dev->dev.bus, struct xen_bus_type, bus);
    2.14 +		/* If we're frontend, drive the state machine to Closed. */
    2.15 +		/* This should cause the backend to release our resources. */
    2.16 +		if ((bus == &xenbus_frontend) && (state == XenbusStateClosing))
    2.17 +			xenbus_frontend_closed(dev);
    2.18 +		return;
    2.19 +	}
    2.20 +
    2.21  	if (drv->otherend_changed)
    2.22  		drv->otherend_changed(dev, state);
    2.23  }