Browse Source

xen-blkfront: handle backend CLOSED without CLOSING

Backend drivers shouldn't transistion to CLOSED unless the frontend is
CLOSED.  If a backend does transition to CLOSED too soon then the
frontend may not see the CLOSING state and will not properly shutdown.

So, treat an unexpected backend CLOSED state the same as CLOSING.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: stable@vger.kernel.org
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
David Vrabel 11 years ago
parent
commit
3661371701
1 changed files with 4 additions and 1 deletions
  1. 4 1
      drivers/block/xen-blkfront.c

+ 4 - 1
drivers/block/xen-blkfront.c

@@ -1904,13 +1904,16 @@ static void blkback_changed(struct xenbus_device *dev,
 	case XenbusStateReconfiguring:
 	case XenbusStateReconfiguring:
 	case XenbusStateReconfigured:
 	case XenbusStateReconfigured:
 	case XenbusStateUnknown:
 	case XenbusStateUnknown:
-	case XenbusStateClosed:
 		break;
 		break;
 
 
 	case XenbusStateConnected:
 	case XenbusStateConnected:
 		blkfront_connect(info);
 		blkfront_connect(info);
 		break;
 		break;
 
 
+	case XenbusStateClosed:
+		if (dev->state == XenbusStateClosed)
+			break;
+		/* Missed the backend's Closing state -- fallthrough */
 	case XenbusStateClosing:
 	case XenbusStateClosing:
 		blkfront_closing(info);
 		blkfront_closing(info);
 		break;
 		break;