From owner-freebsd-current@FreeBSD.ORG Wed Oct 5 00:42:08 2005 Return-Path: X-Original-To: current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B5F7216A421 for ; Wed, 5 Oct 2005 00:42:08 +0000 (GMT) (envelope-from kris@obsecurity.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id ED10C43D46 for ; Wed, 5 Oct 2005 00:42:07 +0000 (GMT) (envelope-from kris@obsecurity.org) Received: from obsecurity.dyndns.org (CPE0050040655c8-CM00111ae02aac.cpe.net.cable.rogers.com [70.30.70.180]) by elvis.mu.org (Postfix) with ESMTP id C90141A3C24; Tue, 4 Oct 2005 17:42:07 -0700 (PDT) Received: by obsecurity.dyndns.org (Postfix, from userid 1000) id BB35951285; Tue, 4 Oct 2005 20:42:06 -0400 (EDT) Date: Tue, 4 Oct 2005 20:42:06 -0400 From: Kris Kennaway To: current@FreeBSD.org Message-ID: <20051005004206.GA40800@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cNdxnHkX5QqsyA0e" Content-Disposition: inline User-Agent: Mutt/1.4.2.1i Cc: jroberson@chesapeake.net Subject: lockf(1) non-serialization X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Oct 2005 00:42:08 -0000 --cNdxnHkX5QqsyA0e Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On an SMP machine with mpsafevfs=1: # cat /tmp/l2.sh mkdir foo rmdir foo # while true; do (lockf lock sh /tmp/l2.sh) & done mkdir: foo: File exists rmdir: foo: No such file or directory mkdir: foo: File exists rmdir: foo: No such file or directory mkdir: foo: File exists [...] It looks like lockf(1) is not serializing requests properly, i.e. it's handing out locks to two processes at once. I first saw this early this year, but then it went away for a while. Kris P.S. lockf(1) is also very lame in how it acquires locks..this patch from Christian fixes that so that multiple lockf processes don't all spin in a thundering herd trying to grab the same lock, but the above bug appears with or without it (just more efficiently with): http://people.freebsd.org/~csjp/lockf.diff --cNdxnHkX5QqsyA0e Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQFDQyFeWry0BWjoQKURAlKmAKCtkGgQYGNVdp83t8T/+XhoTa1NiQCfWr+n q8/ZD/R+Tu3w9XfMOxEZy7o= =CLOR -----END PGP SIGNATURE----- --cNdxnHkX5QqsyA0e--