mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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
This commit is contained in:
parent
da31cbbca0
commit
e5d27b37e3
1 changed files with 7 additions and 4 deletions
|
|
@ -1578,11 +1578,14 @@ xbd_backend_changed(device_t dev, XenbusState backend_state)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue