aboutsummaryrefslogtreecommitdiff
path: root/sys/geom/geom_slice.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2004-07-04 13:44:48 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2004-07-04 13:44:48 +0000
commit8529ce7a875c5bec1e890ed874217f1c630fecbe (patch)
tree82ecbac8961e50272a7d89d0a4ceca452df2a01d /sys/geom/geom_slice.c
parent22c624779b5330d6a42ec4b7e3215de77a76c4ec (diff)
downloadsrc-8529ce7a875c5bec1e890ed874217f1c630fecbe.tar.gz
src-8529ce7a875c5bec1e890ed874217f1c630fecbe.zip
Notes
Diffstat (limited to 'sys/geom/geom_slice.c')
-rw-r--r--sys/geom/geom_slice.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c
index 736ab0c9848c..549005b6dac8 100644
--- a/sys/geom/geom_slice.c
+++ b/sys/geom/geom_slice.c
@@ -99,23 +99,25 @@ g_slice_access(struct g_provider *pp, int dr, int dw, int de)
cp = LIST_FIRST(&gp->consumer);
KASSERT (cp != NULL, ("g_slice_access but no consumer"));
gsp = gp->softc;
- gsl = &gsp->slices[pp->index];
- for (u = 0; u < gsp->nslice; u++) {
- gsl2 = &gsp->slices[u];
- if (gsl2->length == 0)
- continue;
- if (u == pp->index)
- continue;
- if (gsl->offset + gsl->length <= gsl2->offset)
- continue;
- if (gsl2->offset + gsl2->length <= gsl->offset)
- continue;
- /* overlap */
- pp2 = gsl2->provider;
- if ((pp->acw + dw) > 0 && pp2->ace > 0)
- return (EPERM);
- if ((pp->ace + de) > 0 && pp2->acw > 0)
- return (EPERM);
+ if (dr > 0 || dw > 0 || de > 0) {
+ gsl = &gsp->slices[pp->index];
+ for (u = 0; u < gsp->nslice; u++) {
+ gsl2 = &gsp->slices[u];
+ if (gsl2->length == 0)
+ continue;
+ if (u == pp->index)
+ continue;
+ if (gsl->offset + gsl->length <= gsl2->offset)
+ continue;
+ if (gsl2->offset + gsl2->length <= gsl->offset)
+ continue;
+ /* overlap */
+ pp2 = gsl2->provider;
+ if ((pp->acw + dw) > 0 && pp2->ace > 0)
+ return (EPERM);
+ if ((pp->ace + de) > 0 && pp2->acw > 0)
+ return (EPERM);
+ }
}
/* On first open, grab an extra "exclusive" bit */
if (cp->acr == 0 && cp->acw == 0 && cp->ace == 0)