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 --- 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: