file locking starvation?

Tim Smith (tzs@tzs.net)
Sat, 5 Jun 1999 14:23:22 -0700 (PDT)


[I posted about this a couple of weeks ago, when this list was being very
slow. I never saw it appear, so am assuming it got lost]

Consider this situation:

1. Process A locks a file, using fcntl(..., F_SETLKW, ... ).

2. Process B tries to lock the file the same way, and so goes to
sleep waiting for the lock.

3. Process A releases the lock, but then immediately tries to
reaquire it.

On Linux (2.2.9 is the only one I tested), process A gets the lock back in
step #3. Anyone else think that step #3 should put A to sleep and let B
get the lock? An application that wants that behavior can get it by throwing
in a sleep(0) between A's releasing the lock and attempting to reaquire it,
but is it supposed to have to do that?

--Tim Smith

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/