Waldek Hebisch hebisch@math.uni.wroc.pl writes:
There is ongoing disscusion on how to seed up the wineserver. So I have question concerning correctness of corrent implementation. Namely, for reading or writing files I have not found any locking in wineserver when issuing file descriptor to clients. On the other hand the client closes file descriptor just after use, and also disscusion in the group suggests that client is supposed to have exclusive acces to file. So I would like to know what is the case:
- client is allowd to cache the descriptor
- current implementation depends on winning a race
- I missed locking in wineserver
I'm not sure what you mean by 'exclusive access to the file'. If you mean file locking then this is not implemented, so there cannot be any race ;-) Currently the client is allowed to cache the descriptor, but before each read/write it checks with the server that the cache is still valid. There is a race that the handle can be modified between the check and the actual read, this will cause either a bad handle error or a read from the wrong file; but this is no different from what happens under Windows if the client is manipulating handles concurrently with a ReadFile.
On 6 Mar 2001, Alexandre Julliard wrote:
I'm not sure what you mean by 'exclusive access to the file'. If you mean file locking then this is not implemented, so there cannot be any race ;-) Currently the client is allowed to cache the descriptor, but before each read/write it checks with the server that the cache is still valid. There is a race that the handle can be modified between the check and the actual read, this will cause either a bad handle error or a read from the wrong file; but this is no different from what happens under Windows if the client is manipulating handles concurrently with a ReadFile.
What about having the file descriptor cache explictly invaildated? Like, the server keeps track of which file descriptors the various wine processes have cached, and if a process closes or performs some locking operation on a file descriptor, all the other wine proceses that are using that file descriptor are explictly notified. This way processes can assume a file descriptor is valid unless told otherwise... would this be any better performance-wise? Does it fit in to the wineserver architecture nicely? ;)
-Ryan