From owner-svn-src-all@freebsd.org Sun Dec 29 19:33:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47F611E77D5; Sun, 29 Dec 2019 19:33:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m9j21C48z427V; Sun, 29 Dec 2019 19:33:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 249FC1E4DC; Sun, 29 Dec 2019 19:33:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBTJXg8h052696; Sun, 29 Dec 2019 19:33:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTJXglQ052695; Sun, 29 Dec 2019 19:33:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912291933.xBTJXglQ052695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 29 Dec 2019 19:33:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356182 - head/sys/geom/shsec X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom/shsec X-SVN-Commit-Revision: 356182 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 19:33:42 -0000 Author: mav Date: Sun Dec 29 19:33:41 2019 New Revision: 356182 URL: https://svnweb.freebsd.org/changeset/base/356182 Log: Missed part of r356162. If we postpone consumer destruction till close, then the close calls should not be ignored. Delay geom withering till the last close too. MFC after: 2 weeks X-MFC-with: r356162 Sponsored by: iXsystems, Inc. Modified: head/sys/geom/shsec/g_shsec.c Modified: head/sys/geom/shsec/g_shsec.c ============================================================================== --- head/sys/geom/shsec/g_shsec.c Sun Dec 29 19:21:29 2019 (r356181) +++ head/sys/geom/shsec/g_shsec.c Sun Dec 29 19:33:41 2019 (r356182) @@ -184,7 +184,7 @@ g_shsec_orphan(struct g_consumer *cp) g_shsec_remove_disk(cp); /* If there are no valid disks anymore, remove device. */ - if (g_shsec_nvalid(sc) == 0) + if (LIST_EMPTY(&gp->consumer)) g_shsec_destroy(sc, 1); } @@ -199,21 +199,6 @@ g_shsec_access(struct g_provider *pp, int dr, int dw, gp = pp->geom; sc = gp->softc; - if (sc == NULL) { - /* - * It looks like geom is being withered. - * In that case we allow only negative requests. - */ - KASSERT(dr <= 0 && dw <= 0 && de <= 0, - ("Positive access request (device=%s).", pp->name)); - if ((pp->acr + dr) == 0 && (pp->acw + dw) == 0 && - (pp->ace + de) == 0) { - G_SHSEC_DEBUG(0, "Device %s definitely destroyed.", - gp->name); - } - return (0); - } - /* On first open, grab an extra "exclusive" bit */ if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0) de++; @@ -232,6 +217,11 @@ g_shsec_access(struct g_provider *pp, int dr, int dw, g_destroy_consumer(cp1); } } + + /* If there are no valid disks anymore, remove device. */ + if (LIST_EMPTY(&gp->consumer)) + g_shsec_destroy(sc, 1); + return (error); fail: