On Fri, Oct 29, 2010 at 5:01 AM, Charles Forsyth <forsyth@terzarima.net> wrote:
>What you are saying is that the problem could be something like:

>-> Tclunk
>(do not wait for response)
>-> Topen (the file is exclusive)

no, because what actually happens is closer to
       A: Topen
       ...
       queue request to *another process* to send Tclunk
       ...
       A: Topen

leading to either case 1
       A: Topen
       B: Tclunk
       A: Topen

or case 2
       A: Topen
       A: Topen
       B: Tclunk

depending on the scheduling of the two processes A and B

introducing that other process introduces a new race, that simply did not exist before, because
that other process didn't exist before. you always got case 1.

and indeed, with the test i ran on the modified system usually it gets case 1
because of timing, but eventually a case 2 shows up and the second open fails.


Correct. Either ordering is reasonable and not-a-problem when dealing with a decent fileserver. There are certainly file servers and open options that force single-open, but this approach is not for them.

-- vs