aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2004-02-06 23:10:49 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2004-02-06 23:10:49 +0000
commit12047230cde3052870a8006962967737e83e659d (patch)
tree2cf7a23680d10f92f66dd9868ee80484d67d0735
parent5b2f81ec4be4b3b0fa6a6752da1b6519efd9071d (diff)
downloadsrc-12047230cde3052870a8006962967737e83e659d.tar.gz
src-12047230cde3052870a8006962967737e83e659d.zip
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)
Notes
Notes: svn path=/head/; revision=125539
-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 06ee392c3fe5..4cdf963355b2 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) {