Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Oct 2005 20:42:06 -0400
From:      Kris Kennaway <kris@obsecurity.org>
To:        current@FreeBSD.org
Cc:        jroberson@chesapeake.net
Subject:   lockf(1) non-serialization
Message-ID:  <20051005004206.GA40800@xor.obsecurity.org>

next in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051005004206.GA40800>