From a47b0e4a84090dba8b66931eb8f2b92fb9fcd799 Mon Sep 17 00:00:00 2001 From: phk Date: Wed, 2 Apr 2003 13:10:40 +0000 Subject: Only orphan things if the open/close actually succeeded. --- sys/geom/geom_subr.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'sys') diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index 6acf86e..f2c43fe 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -437,18 +437,18 @@ g_access_rel(struct g_consumer *cp, int dcr, int dcw, int dce) /* Ok then... */ - /* - * If we open first write, spoil any partner consumers. - * If we close last write, trigger re-taste. - */ - if (pp->acw == 0 && dcw != 0) - g_spoil(pp, cp); - else if (pp->acw != 0 && pp->acw == -dcw && - !(pp->geom->flags & G_GEOM_WITHER)) - g_post_event(EV_NEW_PROVIDER, NULL, NULL, pp, NULL); - error = pp->geom->access(pp, dcr, dcw, dce); if (!error) { + /* + * If we open first write, spoil any partner consumers. + * If we close last write, trigger re-taste. + */ + if (pp->acw == 0 && dcw != 0) + g_spoil(pp, cp); + else if (pp->acw != 0 && pp->acw == -dcw && + !(pp->geom->flags & G_GEOM_WITHER)) + g_post_event(EV_NEW_PROVIDER, NULL, NULL, pp, NULL); + pp->acr += dcr; pp->acw += dcw; pp->ace += dce; @@ -473,7 +473,6 @@ g_handleattr_off_t(struct bio *bp, const char *attribute, off_t val) return (g_handleattr(bp, attribute, &val, sizeof val)); } - int g_handleattr(struct bio *bp, const char *attribute, void *val, int len) { -- cgit v1.1