summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_disk.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-02-06 23:10:49 +0000
committerpjd <pjd@FreeBSD.org>2004-02-06 23:10:49 +0000
commit9ebcd20d3509596a9f21210d6603ebc16aa38d03 (patch)
tree2cf7a23680d10f92f66dd9868ee80484d67d0735 /sys/geom/geom_disk.c
parenteb1889fd1b7196385ef0bfae18e3e4f6fdda7094 (diff)
downloadFreeBSD-src-9ebcd20d3509596a9f21210d6603ebc16aa38d03.zip
FreeBSD-src-9ebcd20d3509596a9f21210d6603ebc16aa38d03.tar.gz
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)
Diffstat (limited to 'sys/geom/geom_disk.c')
-rw-r--r--sys/geom/geom_disk.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index 06ee392..4cdf963 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -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) {
OpenPOWER on IntegriCloud