Red Hat Bugzilla – Bug 160844
dangling POSIX locks after close
Last modified: 2007-11-30 17:07:18 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.7) Gecko/20050416 Red Hat/1.0.3-1.4.1 Firefox/1.0.3
Description of problem:
There is a race between fcntl and close which can result in orphanned POSIX
locks. In general, these races are handled via the support to remove locks
when the last reference to an open file is released. Sometimes, this does
not occur in a timely fashion and could cause problems. This can happen
because an application was holding a reference to an open file, which would
delay the last reference to an open file being released.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Compile and run the attach test program.
Actual Results: The test program attempts to lock what should be a completely unlocked file.
The lock attempt fails because there is a lock outstanding on the file, long
after it should have been released.
Expected Results: The lock attempt made in the test program should succeed.
This bug has already been fixed in RHEL 3 U6. The problem continues to exist
in RHEL 4, although not with the same severity.
Created attachment 115635 [details]
Test program to reproduce the situation.
The test program should be run with a "delay" argument of at least 30 seconds.
This is due to some issue with the multithreading on RHEL 4 which I've not
looked into yet.
Created attachment 116125 [details]
A patch containing these changes has been accepted upstream into the '-mm'
Created attachment 117209 [details]
The proposed patch was sent upstream. After review, it was simplified very
slightly and has been sent to Linus for inclusion into his kernel.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.