From owner-freebsd-geom@FreeBSD.ORG Thu Oct 25 07:28:40 2012 Return-Path: Delivered-To: freebsd-geom@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A086F4F; Thu, 25 Oct 2012 07:28:40 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 42AF28FC0A; Thu, 25 Oct 2012 07:28:40 +0000 (UTC) Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id 03B053B77C; Thu, 25 Oct 2012 07:28:31 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.5/8.14.5) with ESMTP id q9P7SVLB028186; Thu, 25 Oct 2012 07:28:31 GMT (envelope-from phk@phk.freebsd.dk) To: Andriy Gapon Subject: Re: geom access method and g_topology_lock In-reply-to: <5088E0E0.2080307@FreeBSD.org> From: "Poul-Henning Kamp" References: <5088E0E0.2080307@FreeBSD.org> Date: Thu, 25 Oct 2012 07:28:31 +0000 Message-ID: <28185.1351150111@critter.freebsd.dk> Cc: freebsd-geom@FreeBSD.org X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Oct 2012 07:28:40 -0000 -------- In message <5088E0E0.2080307@FreeBSD.org>, Andriy Gapon writes: >The problem is that the following innocent-looking code may become not quite so >innocent: > >g_topology_assert(); >g_access(cp, -1, 0, -1); >/* a lot might have happened between these two lines */ >g_detach(cp); >g_destroy_consumer(cp); It really depends what "a lot" actually is. It is perfectly legal and acceptable for a consumer to be attached to a provider without holding an access count. But lacking an access count, there are obviously things you cannot do to that provider. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.