From owner-cvs-src@FreeBSD.ORG Wed Jun 9 16:40:44 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 253F216A4CE; Wed, 9 Jun 2004 16:40:44 +0000 (GMT) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 891F343D5A; Wed, 9 Jun 2004 16:40:43 +0000 (GMT) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.11/8.12.11) with ESMTP id i59GegJ0056222; Wed, 9 Jun 2004 18:40:42 +0200 (CEST) (envelope-from phk@phk.freebsd.dk) To: Doug Rabson From: "Poul-Henning Kamp" In-Reply-To: Your message of "Wed, 09 Jun 2004 17:25:00 BST." <1086798299.12306.3.camel@builder02.qubesoft.com> Date: Wed, 09 Jun 2004 18:40:42 +0200 Message-ID: <56221.1086799242@critter.freebsd.dk> cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern kern_proc.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2004 16:40:44 -0000 In message <1086798299.12306.3.camel@builder02.qubesoft.com>, Doug Rabson write s: >> GOOD: >> >> LOCK(foo->lock) >> i = --foo->refcount; >> UNLOCK(foo->lock) >> if (i == 0) >> destroy(foo); > >Isn't there still a race in the GOOD case here if somone takes a new >reference, incrementing refcount after the UNLOCK(foo->lock)? Convetionally, once the refcount==0 it means that nobody will reference it anymore. If you violate this by design (like for instance in the vnode cache), then you need to cope with that problem, and things get ugly fast (like for instance in the vnode cache). -- 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.