svn commit: r318520 - head/sys/dev/xen/blkfront

Roger Pau Monné royger at FreeBSD.org
Fri May 19 08:11:16 UTC 2017


Author: royger
Date: Fri May 19 08:11:15 2017
New Revision: 318520
URL: https://svnweb.freebsd.org/changeset/base/318520

Log:
  xen/blkfront: correctly detach a disk with active users
  
  Call disk_gone when the backend switches to the "Closing" state and blkfront
  still has pending users. This allows the disk to be detached, and will call
  into xbd_closing by itself when the geom layout cleanup has finished.
  
  Reported by:		bapt
  Tested by:		manu
  Reviewed by:		bapt
  Sponsored by:		Citrix Systems R&D
  MFC after:		1 week
  Differential revision:	https://reviews.freebsd.org/D10772

Modified:
  head/sys/dev/xen/blkfront/blkfront.c

Modified: head/sys/dev/xen/blkfront/blkfront.c
==============================================================================
--- head/sys/dev/xen/blkfront/blkfront.c	Fri May 19 07:31:48 2017	(r318519)
+++ head/sys/dev/xen/blkfront/blkfront.c	Fri May 19 08:11:15 2017	(r318520)
@@ -1578,11 +1578,14 @@ xbd_backend_changed(device_t dev, Xenbus
 		break;
 
 	case XenbusStateClosing:
-		if (sc->xbd_users > 0)
-			xenbus_dev_error(dev, -EBUSY,
-			    "Device in use; refusing to close");
-		else
+		if (sc->xbd_users > 0) {
+			device_printf(dev, "detaching with pending users\n");
+			KASSERT(sc->xbd_disk != NULL,
+			    ("NULL disk with pending users\n"));
+			disk_gone(sc->xbd_disk);
+		} else {
 			xbd_closing(dev);
+		}
 		break;	
 	}
 }


More information about the svn-src-head mailing list