From owner-cvs-all@FreeBSD.ORG Fri Oct 5 19:11:42 2007 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 315A916A417; Fri, 5 Oct 2007 19:11:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from gnome.kiev.sovam.com (gnome.kiev.sovam.com [212.109.32.24]) by mx1.freebsd.org (Postfix) with ESMTP id C184A13C43E; Fri, 5 Oct 2007 19:11:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com ([62.64.120.197]) by gnome.kiev.sovam.com with esmtp (Exim 4.67 (FreeBSD)) (envelope-from ) id 1IdsaK-000OI9-2H; Fri, 05 Oct 2007 22:11:40 +0300 Received: from [212.82.216.226] (helo=deviant.kiev.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1IdsaI-000PTD-Kf; Fri, 05 Oct 2007 22:11:39 +0300 Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l95JBYgT007826; Fri, 5 Oct 2007 22:11:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1/Submit) id l95JBYUu007825; Fri, 5 Oct 2007 22:11:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 5 Oct 2007 22:11:34 +0300 From: Kostik Belousov To: John Baldwin Message-ID: <20071005191134.GA2180@deviant.kiev.zoral.com.ua> References: <200710032106.l93L65bv095725@repoman.freebsd.org> <200710041219.13202.jhb@freebsd.org> <20071004182759.U912@10.0.0.1> <200710051350.39581.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="azLHFNyN32YCQGCU" Content-Disposition: inline In-Reply-To: <200710051350.39581.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Scanner-Signature: 9596209fecb99bc4db4bd854cc333b75 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Info: Profiles 1563 [Oct 05 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {TO: local part of email appears in body} X-SpamTest-Info: {received from trusted relay: not dialup} X-SpamTest-Method: none X-SpamTest-Method: Local Lists X-SpamTest-Rate: 10 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: Jeff Roberson , src-committers@freebsd.org, cvs-all@freebsd.org, cvs-src@freebsd.org Subject: Re: cvs commit: src/sys/fs/devfs devfs_vnops.c src/sys/fs/fifofs fifo_vnops.c src/sys/kern uipc_usrreq.c vfs_vnops.c src/sys/vm vnode_pager.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Oct 2007 19:11:42 -0000 --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 05, 2007 at 01:50:39PM -0400, John Baldwin wrote: > On Thursday 04 October 2007 09:29:25 pm Jeff Roberson wrote: > > On Thu, 4 Oct 2007, John Baldwin wrote: > >=20 > > > On Wednesday 03 October 2007 07:48:00 pm Jeff Roberson wrote: > > >> On Wed, 3 Oct 2007, John Baldwin wrote: > > >> > > >>> jhb 2007-10-03 21:06:05 UTC > > >>> > > >>> FreeBSD src repository > > >>> > > >>> Modified files: (Branch: RELENG_6) > > >>> sys/fs/devfs devfs_vnops.c > > >>> sys/fs/fifofs fifo_vnops.c > > >>> sys/kern uipc_usrreq.c vfs_vnops.c > > >>> sys/vm vnode_pager.c > > >>> Log: > > >>> MFC: Always use an exclusive lock on the leaf vnode during an open= ()=20 > when > > >>> shared lookups are enabled. This closes a few races including a r= ace > > > where > > >>> concurrent opens of a fifo could result in different v_fifoinfo > > > structures > > >>> in different threads. > > >> > > >> Long term we should really look for a better solution to this proble= m. > > >> There are a number of was to improve snapshots in ffs by fixing shar= ed > > >> locking. > > > > > > I don't disagree. The fifo case can be fixed easily enough in the fi= fo=20 > code > > > by using fifo_mtx to protect v_fifoinfo perhaps (or doing an upgrade = on=20 > the > > > vnode lock?), but for the MFC I didn't want to have to fix each of th= e=20 > races > > > with open(2). Probably better to fix it more properly in HEAD first. > >=20 > > Definitely someting for head. Were there any others that you ran into= =20 > > besides v_fifoinfo? We should audit this more closely anyhow. I have= =20 > > been reluctant to push too much shared locking into VFS because it's no= t=20 > > been so carefully studied. >=20 > I just saw v_fifoinfo, but Pawel's original commit referenced updates to > v_writecount, etc. The v_writecount one is in vn_open() itself: >=20 > if ((error =3D VOP_OPEN(vp, fmode, cred, td, fp)) !=3D 0) > goto bad; >=20 > if (fmode & FWRITE) > vp->v_writecount++; > *flagp =3D fmode; > ASSERT_VOP_ELOCKED(vp, "vn_open_cred"); > if (!mpsafe) > VFS_UNLOCK_GIANT(vfslocked); > return (0); >=20 > If you just held a shared lock there, you could use atomic ops for=20 > vp->v_writecount (and still hold at least a shared vnode lock everywhere= =20 > v_writecount is updated) and still be able to read vp->v_writecount safel= y=20 > while holding an exclusive lock on the vnode. Another is the vm/vnode_pager.c handling of the v_object. --azLHFNyN32YCQGCU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFHBoxlC3+MBN1Mb4gRAqH2AJ9niEBYlR9SKGUgmIDChfVlhg9RnQCePY+k ww4Jedi/GQ4M2FxzZ5abWqY= =8UIa -----END PGP SIGNATURE----- --azLHFNyN32YCQGCU--