From owner-cvs-src@FreeBSD.ORG Wed Dec 20 16:17:48 2006 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8DE7B16A416 for ; Wed, 20 Dec 2006 16:17:48 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8FDF743CB3 for ; Wed, 20 Dec 2006 16:17:13 +0000 (GMT) (envelope-from asmrookie@gmail.com) Received: by ug-out-1314.google.com with SMTP id o2so1973611uge for ; Wed, 20 Dec 2006 08:16:54 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=RHmcoHZLORCA18o04Rfaw3k2pxsQLRabhl2Zo00fr6sVxzfWzBwQ5RtGf2FcU88AWkhqjRRYjxuRFb5NEZJWlgcl7PG3h63W3mhfdzx6zDc+Oxcj/y1SxkYURS8KRj0P1eDbUAIwkvYCU6cxlxjUU5gKATvpWNqtF72lMPd1zBU= Received: by 10.82.136.4 with SMTP id j4mr1753340bud.1166631411328; Wed, 20 Dec 2006 08:16:51 -0800 (PST) Received: by 10.82.178.4 with HTTP; Wed, 20 Dec 2006 08:16:51 -0800 (PST) Message-ID: <3bbf2fe10612200816x11c59af3r8b1d2721215267fe@mail.gmail.com> Date: Wed, 20 Dec 2006 17:16:51 +0100 From: "Attilio Rao" Sender: asmrookie@gmail.com To: "Martin Blapp" In-Reply-To: <20061220040337.H53548@godot.imp.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200612192234.kBJMYYo0055529@repoman.freebsd.org> <3bbf2fe10612191850y3a546fcew486575385b1400df@mail.gmail.com> <20061220040337.H53548@godot.imp.ch> X-Google-Sender-Auth: 27ba6d89c31966db Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/kern tty.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 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, 20 Dec 2006 16:17:48 -0000 2006/12/20, Martin Blapp : > > Hi, > > > Since proctree_lock is a sx lock which uses 2 condition variables, > > they alredy drop Giant (DROP_GIANT()) before sleeping. Are you secure > > it is the right thing to do here? > > Sorry, the commit message was not 100% clear. It should have been: > > Retest a variable after sx_slock has been called. Giant might have been > temporarily dropped while waiting for proctree_lock, allowing for an > intervening tty_close() that cleared tp->t_session. Ok, after a quick look at the patch (and this note) it makes more sense to me, but then would not be cleaner to do something like: sx_slock(&proctree_lock); if (tp->t_session && tp->t_session->s_leader) { ... } sx_sunlock(&proctree_lock); more than leaving the clobbering check? Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein