From owner-freebsd-fs@FreeBSD.ORG Mon Jul 9 20:40:12 2012 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0010106564A; Mon, 9 Jul 2012 20:40:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 4ADAC8FC12; Mon, 9 Jul 2012 20:40:12 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q69KeKaO081492; Mon, 9 Jul 2012 23:40:20 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q69Ke8P6077996; Mon, 9 Jul 2012 23:40:08 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q69Ke7CQ077995; Mon, 9 Jul 2012 23:40:07 +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: Mon, 9 Jul 2012 23:40:07 +0300 From: Konstantin Belousov To: John Baldwin Message-ID: <20120709204007.GW2338@deviant.kiev.zoral.com.ua> References: <201203071318.08241.jhb@freebsd.org> <201203161406.27549.jhb@freebsd.org> <201206060817.54684.jhb@freebsd.org> <201207091138.15655.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JQJYpj0es6mGpGbU" Content-Disposition: inline In-Reply-To: <201207091138.15655.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-fs@freebsd.org, pho@freebsd.org Subject: Re: close() of an flock'd file is not atomic X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2012 20:40:12 -0000 --JQJYpj0es6mGpGbU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 09, 2012 at 11:38:15AM -0400, John Baldwin wrote: > Here now is the tested version of the actual fix after the vn_open_vnode() > changes were committed. This is hopefully easier to parse now. >=20 > http://www.FreeBSD.org/~jhb/patches/flock_open_close4.patch Do you need atomic op to set FHASLOCK in vn_open_cred ? I do not think *fp can be shared with other thread there. I thought that vrele() call in vn_closefile() would need a vn_start_write() or vn_start_secondary_write() dance around it, but now I believe it is not needed, since ufs_inactive() handles start of secondary writes on its own. Still, it would be good if Peter could test the patch with snapshotting load just be to safe there. --JQJYpj0es6mGpGbU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/7QacACgkQC3+MBN1Mb4iTRACeOu2eM6kV/PjF/9gnxDeE68BI M8AAoJoD2wTvzkW/yJb8kj9rtutSjdOO =MTYo -----END PGP SIGNATURE----- --JQJYpj0es6mGpGbU--