From owner-svn-src-stable@FreeBSD.ORG Sun Nov 22 22:07:54 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C266106566B; Sun, 22 Nov 2009 22:07:54 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id 4FD4E8FC19; Sun, 22 Nov 2009 22:07:52 +0000 (UTC) Received: by bwz5 with SMTP id 5so4912264bwz.3 for ; Sun, 22 Nov 2009 14:07:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=hGp8b+hi9cNVy+tQxZjXd4BdQQDp039kPgtr3fum1Hg=; b=kaFJg6e6YUvwTOK9jwWgt8zSj7vyRltVHgpUpaBdSXSOTN1EuiPyAkdeeV5HyJb25h /NswNNQEvm4W6VrE1eNQePCfueMwaX1U5J3RdnUNx9GYnb346yD1ISNKCW2daMq3mfsy ixSbZRC8ft+o119Oo0fPdYsmkXKuDOzKQfZpA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=lO5Wo8oCk1lnhDHnj6/j28nHXIQhlNnqEaeXINJeHgWFreryoH26C2SR/6biaw/JL/ BRdICAe7iPIK6ljoHWunZztP3GIMP8aSoKBtnlZ9YUbxP+JMq2w+3pGSKYe3mupOT1Dm RGrGSKphjy21iM0UgC6iGFD6lxJAjgpVag/Gk= MIME-Version: 1.0 Received: by 10.204.154.216 with SMTP id p24mr4005862bkw.16.1258927672003; Sun, 22 Nov 2009 14:07:52 -0800 (PST) In-Reply-To: <200911221609.nAMG9REa022880@svn.freebsd.org> References: <200911221609.nAMG9REa022880@svn.freebsd.org> Date: Sun, 22 Nov 2009 22:07:51 +0000 Message-ID: <6101e8c40911221407w54fbac5bn590b8c21c37ced11@mail.gmail.com> From: Oliver Pinter To: Attilio Rao Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r199652 - stable/8/sys/fs/fifofs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Nov 2009 22:07:54 -0000 this for 7-STABLE? On 11/22/09, Attilio Rao wrote: > Author: attilio > Date: Sun Nov 22 16:09:27 2009 > New Revision: 199652 > URL: http://svn.freebsd.org/changeset/base/199652 > > Log: > MFC r199007: > Fix a memory leak. > > Modified: > stable/8/sys/fs/fifofs/fifo_vnops.c > Directory Properties: > stable/8/sys/ (props changed) > stable/8/sys/amd64/include/xen/ (props changed) > stable/8/sys/cddl/contrib/opensolaris/ (props changed) > stable/8/sys/contrib/dev/acpica/ (props changed) > stable/8/sys/contrib/pf/ (props changed) > stable/8/sys/dev/xen/xenpci/ (props changed) > > Modified: stable/8/sys/fs/fifofs/fifo_vnops.c > ============================================================================== > --- stable/8/sys/fs/fifofs/fifo_vnops.c Sun Nov 22 16:04:49 2009 (r199651) > +++ stable/8/sys/fs/fifofs/fifo_vnops.c Sun Nov 22 16:09:27 2009 (r199652) > @@ -78,6 +78,10 @@ struct fileops fifo_ops_f = { > /* > * This structure is associated with the FIFO vnode and stores > * the state associated with the FIFO. > + * Notes about locking: > + * - fi_readsock and fi_writesock are invariant since init time. > + * - fi_readers and fi_writers are vnode lock protected. > + * - fi_wgen is fif_mtx lock protected. > */ > struct fifoinfo { > struct socket *fi_readsock; > @@ -215,14 +219,9 @@ fail1: > } > > /* > - * General access to fi_readers and fi_writers is protected using > - * the vnode lock. > - * > - * Protect the increment of fi_readers and fi_writers and the > - * associated calls to wakeup() with the fifo mutex in addition > - * to the vnode lock. This allows the vnode lock to be dropped > - * for the msleep() calls below, and using the fifo mutex with > - * msleep() prevents the wakeup from being missed. > + * Use the fifo_mtx lock here, in addition to the vnode lock, > + * in order to allow vnode lock dropping before msleep() calls > + * and still avoiding missed wakeups. > */ > mtx_lock(&fifo_mtx); > if (ap->a_mode & FREAD) { > @@ -241,6 +240,8 @@ fail1: > if (ap->a_mode & FWRITE) { > if ((ap->a_mode & O_NONBLOCK) && fip->fi_readers == 0) { > mtx_unlock(&fifo_mtx); > + if (fip->fi_writers == 0) > + fifo_cleanup(vp); > return (ENXIO); > } > fip->fi_writers++; > _______________________________________________ > svn-src-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable > To unsubscribe, send any mail to "svn-src-stable-unsubscribe@freebsd.org" >