Jan Beulich
2012-Mar-09 14:11 UTC
[PATCH] 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. Signed-off-by: Jan Beulich <jbeulich@suse.com> --- a/drivers/xen/blkback/xenbus.c +++ b/drivers/xen/blkback/xenbus.c @@ -392,13 +392,11 @@ static void frontend_changed(struct xenb break; 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 Xen-devel@lists.xen.org http://lists.xen.org/xen-devel