linux-2.6.18/blkback: also call blkif_disconnect() when frontend switched to closed
PATCH 1/1 linux-2.6.18/blkback: also call blkif_disconnect() when frontend switched to closed
blkfront doesn't normally set its state to XenbusStateClosing, yet blkback should not hang on to resources when there's no connection. As frontend_changed() already makes use of blkif_disconnect() being idempotent, we're fine to utilize this here too.
drivers/xen/blkback/xenbus.c +4 -6
@@ -392,13 +392,11 @@ static void frontend_changed(struct xenbbreak ;case XenbusStateClosing: -blkif_disconnect (be->blkif); -xenbus_switch_state (dev, XenbusStateClosing); -break ; -case XenbusStateClosed: -xenbus_switch_state (dev, XenbusStateClosed); -if (xenbus_dev_is_online (dev)) +blkif_disconnect (be->blkif); +xenbus_switch_state (dev, frontend_state); +if (frontend_state != XenbusStateClosed || +xenbus_dev_is_online (dev))break ;/* fall through if not online */ case XenbusStateUnknown:
blkback: also call blkif_disconnect() when frontend switched to closed
blkfront doesn't normally set its state to XenbusStateClosing, yet blkback should not hang on to resources when there's no connection. As frontend_changed() already makes use of blkif_disconnect() being idempotent, we're fine to utilize this here too.
drivers/xen/blkback/xenbus.c +4 -6
@@ -392,13 +392,11 @@ static void frontend_changed(struct xenbbreak ;case XenbusStateClosing: -blkif_disconnect (be->blkif); -xenbus_switch_state (dev, XenbusStateClosing); -break ; -case XenbusStateClosed: -xenbus_switch_state (dev, XenbusStateClosed); -if (xenbus_dev_is_online (dev)) +blkif_disconnect (be->blkif); +xenbus_switch_state (dev, frontend_state); +if (frontend_state != XenbusStateClosed || +xenbus_dev_is_online (dev))break ;/* fall through if not online */ case XenbusStateUnknown:
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel