Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 May 2017 08:11:15 +0000 (UTC)
From:      =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= <royger@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r318520 - head/sys/dev/xen/blkfront
Message-ID:  <201705190811.v4J8BFve000557@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;	
 	}
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705190811.v4J8BFve000557>