Christian S.J. Peron 6a53f0a52b Revision 1.12 of lockf.c fixed a "thundering herd" scenario when the
lock experienced contention a number of processes would race to acquire
lock when it was released.  This problem resulted in a lot of CPU
load as well as locks being picked up out of order.

Unfortunately, a regression snuck in which allowed multiple threads
to pickup the same lock when -k was not used.  This could occur when
multiple processes open a file descriptor to inode X (one process
will be blocked) and the file is unlinked on unlock (thereby removing
the directory entry allow another process to create a new directory
entry for the same file name and lock it).

This changes restores the old algorithm of: wait for the lock, then
acquire lock when we want to unlink the file on exit (specifically
when -k is not used) and keeps the new algorithm for when -k is used,
which yields fairness and improved performance.

Also, update the man page to inform users that if lockf(1) is being
used to facilitate concurrency between a number of processes, it
is recommended that -k be used to reduce CPU load and yeld
fairness with regard to lock ordering.

Collaborated with:	jdp
PR:		bin/114341
PR:		bin/116543
PR:		bin/111101
MFC after:	1 week
2007-10-12 14:56:52 +00:00
..
2006-12-28 04:58:38 +00:00
2007-09-11 01:59:00 +00:00
2007-03-09 14:36:18 +00:00
2007-03-28 07:48:03 +00:00
2007-03-10 07:10:01 +00:00
2007-03-10 07:11:20 +00:00
2005-01-25 22:32:48 +00:00
2006-09-25 15:06:24 +00:00
2005-02-13 22:25:33 +00:00
2005-01-25 22:32:48 +00:00
2005-11-18 10:36:29 +00:00
2005-01-25 22:32:48 +00:00
2006-12-24 19:55:38 +00:00
2006-12-18 15:36:31 +00:00
2006-07-27 14:20:14 +00:00
2005-02-13 22:25:33 +00:00
2006-08-23 12:12:56 +00:00
2005-02-09 18:07:17 +00:00
2006-12-24 14:23:35 +00:00
2006-09-13 05:06:12 +00:00
2007-03-09 12:45:00 +00:00
2006-05-15 08:20:38 +00:00
2004-07-03 00:24:45 +00:00
2005-02-13 22:25:33 +00:00
2007-05-12 12:23:40 +00:00
2007-06-04 01:43:25 +00:00
2006-08-20 15:52:17 +00:00
2005-02-13 22:25:33 +00:00
2006-12-26 10:37:37 +00:00
2006-07-18 10:19:46 +00:00
2007-03-25 18:37:59 +00:00
2006-08-28 08:27:02 +00:00
2005-01-18 13:43:56 +00:00
2006-12-15 14:14:17 +00:00
2007-03-04 08:24:13 +00:00
2006-09-29 15:20:48 +00:00
2005-01-17 17:45:38 +00:00
2005-11-18 10:36:29 +00:00
2005-02-07 08:44:34 +00:00
2006-12-25 20:30:10 +00:00
2007-03-25 18:37:59 +00:00
2007-04-03 19:14:39 +00:00
2006-12-26 12:43:12 +00:00
2006-07-30 07:41:28 +00:00
2005-11-13 21:03:56 +00:00
2004-07-03 00:24:45 +00:00
2005-01-18 13:43:56 +00:00
2006-09-29 15:20:48 +00:00
2007-07-24 06:41:07 +00:00
2006-12-24 19:18:52 +00:00
2005-03-11 14:17:12 +00:00
2006-10-12 21:10:55 +00:00
2007-01-20 08:24:02 +00:00
2007-02-27 12:06:02 +00:00
2005-01-18 13:43:56 +00:00
2007-05-17 00:19:56 +00:00
2005-02-13 22:25:33 +00:00
2006-11-23 05:08:06 +00:00
2006-08-29 18:11:20 +00:00
2006-12-23 19:15:39 +00:00
2006-12-14 19:02:48 +00:00
2006-12-14 00:02:44 +00:00
2005-04-09 14:31:41 +00:00
2006-12-13 12:09:41 +00:00
2005-08-25 14:09:35 +00:00
2006-09-29 15:20:48 +00:00
2006-09-29 15:20:48 +00:00
2006-12-29 13:08:46 +00:00
2005-01-18 13:43:56 +00:00
2006-12-28 10:58:06 +00:00