Bug in flock(3) in 4.2BSD.

Stephen J. Muir stephen at dcl-cs.UUCP
Thu Dec 12 13:39:22 AEST 1985


Consider the following scenario:
1. process 0 starts and opens a file
2. process 1 starts and opens the same file
3. process 2 starts and opens the same file
4. process 1 applies a shared lock and succeeds
5. process 2 attempts to apply an exclusive lock and hangs
6. process 1 attempts to upgrade its lock to an exclusive one and hangs

Process 1 should not have hung here.

7. I kill process 2

Process 1 is still hung.

8. I kill process 1
9. process 3 starts and opens the same file
10. process 3 attempts to apply an exclusive lock and hangs

Process 3 should not have hung here.

11. I kill processes 0 & 3
12. process 4 starts and opens the same file
13. process 4 applies an exclusive lock and succeeds

This is correct.
-- 
UUCP:	...!seismo!mcvax!ukc!dcl-cs!stephen
DARPA:	stephen%comp.lancs.ac.uk at ucl-cs	| Post: University of Lancaster,
JANET:	stephen at uk.ac.lancs.comp	|	Department of Computing,
Phone:	+44 524 65201 Ext. 4599		|	Bailrigg, Lancaster, UK.
Project:Alvey ECLIPSE Distribution	|	LA1 4YR



More information about the Comp.bugs.4bsd.ucb-fixes mailing list