lkml.org 
[lkml]   [2003]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectflock races causes E_NOLCK
Hello,
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:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=linux.fsdevel.sxr8lna7wp.fsf%40eurologic.com&rnum=4&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3DRLIMIT_LOCKS%26btnG%3DGoogle%2BSearch

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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

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