[lkml]   [2003]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectflock races causes E_NOLCK
I'm having a problem with flock on 2.4.18 kernel.
The scenario is like this:

parent process:
open file
fcntl(file, FD_SETFD, 1) // set CLOEXEC bit
flock file
fork/exec child process
close file

child process
open the same file
flock this file
close file

This sometimes (often) results in child process being unable to do any
further locking with the error 37 (no locks available).
Removing fcntl and doing an explicit close of all open file desciprotrs in
the beginning of child leads to the same problem.

Here is a post from Pat Knight descirbing similar problem:

I can't directly map his problem onto mine, but it's pretty clear that
somehow (usigned) current->locks is decremented when it is 0.

For some reason, however, simplistic test program doens't hit this
condition, so I suspect my analysis is not 100% correct. I'm sure, though,
that current->locks is getting messed up somehow.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:35    [W:0.018 / U:41.308 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site