Allow decreasing access count even if there is no disk anymore.

This will allow closing disks that were removed while opened.

Approved by:	phk, scottl (mentor)
This commit is contained in:
Pawel Jakub Dawidek 2004-02-06 23:10:49 +00:00
parent 5b2f81ec4b
commit 12047230cd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=125539

View file

@ -109,12 +109,20 @@ g_disk_access(struct g_provider *pp, int r, int w, int e)
g_trace(G_T_ACCESS, "g_disk_access(%s, %d, %d, %d)",
pp->name, r, w, e);
g_topology_assert();
dp = pp->geom->softc;
if (dp == NULL) {
/*
* Allow decreasing access count even if disk is not
* avaliable anymore.
*/
if (r <= 0 && w <= 0 && e <= 0)
return (0);
else
return (ENXIO);
}
r += pp->acr;
w += pp->acw;
e += pp->ace;
dp = pp->geom->softc;
if (dp == NULL)
return (ENXIO);
error = 0;
if ((pp->acr + pp->acw + pp->ace) == 0 && (r + w + e) > 0) {
if (dp->d_open != NULL) {