Date: Thu, 2 Jan 2020 20:33:57 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r356285 - stable/12/sys/geom/eli Message-ID: <202001022033.002KXvLp042509@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Thu Jan 2 20:33:56 2020 New Revision: 356285 URL: https://svnweb.freebsd.org/changeset/base/356285 Log: MFC r349586 (by rlibby): g_eli_create: only dec g_access acw if we inc'd it Modified: stable/12/sys/geom/eli/g_eli.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/geom/eli/g_eli.c ============================================================================== --- stable/12/sys/geom/eli/g_eli.c Thu Jan 2 20:30:53 2020 (r356284) +++ stable/12/sys/geom/eli/g_eli.c Thu Jan 2 20:33:56 2020 (r356285) @@ -743,7 +743,7 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp; struct g_consumer *cp; u_int i, threads; - int error; + int dcw, error; G_ELI_DEBUG(1, "Creating device %s%s.", bpp->name, G_ELI_SUFFIX); @@ -796,10 +796,8 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, * We don't open provider for writing only when user requested read-only * access. */ - if (sc->sc_flags & G_ELI_FLAG_RO) - error = g_access(cp, 1, 0, 1); - else - error = g_access(cp, 1, 1, 1); + dcw = (sc->sc_flags & G_ELI_FLAG_RO) ? 0 : 1; + error = g_access(cp, 1, dcw, 1); if (error != 0) { if (req != NULL) { gctl_error(req, "Cannot access %s (error=%d).", @@ -911,7 +909,7 @@ failed: mtx_destroy(&sc->sc_queue_mtx); if (cp->provider != NULL) { if (cp->acr == 1) - g_access(cp, -1, -1, -1); + g_access(cp, -1, -dcw, -1); g_detach(cp); } g_destroy_consumer(cp);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001022033.002KXvLp042509>