As far as we can see Windows file locks are not being passed through from OSX shares to Parallels VMs. The scenario is as follows: I have two VMs open, one with Vista and one with XP (but it also happens with two XP VMs). I create a file with a Windows application in one of the VMs and store it in the /Public folder of my OSX user account. The application locks the file it has open, so nobody else should be able to open it in anything but read only -- if I open a second instance of the application in the same VM this works. However, if I then open an instance of the application in the second VM and open the same file it is not locked. The lock is not being passed through by Parallels.
We wrote a test application to test this that can run through all possible Windows file lock scenarios, including read, read/write and write for OpenMode, and ShareExclusive, ShareDenyWrite, ShareDenyRead for ShareMode, plus Lock, DoubleLock and DoubleLockEX for locking. In all cases it is ALWAYS possible to open the locked file in the second instance of Parallels.
Since locking is working in two instances of the same program in the same Parallels VM this demonstrates that Windows file locking IS working on the OSX share. My guess is that what is happening is that Parallels is cacheing the file reads in each VM to speed up read/write operations and not updating the cache when the file is changed in the other VM. So when I "access" the file in the second VM I am actually accessing the cached read-ahead copy, which does not yet have a file lock on it.
Unfortunately, this "unlocked" state persists when the file is written, making it possible for two instances of programs in two VMs to trash each other's writes by overwriting them, even though the files are officially locked.
If this is what is happening it would be quite a serious bug and security hole. Can anyone confirm this?
We wrote a test application to test this that can run through all possible Windows file lock scenarios, including read, read/write and write for OpenMode, and ShareExclusive, ShareDenyWrite, ShareDenyRead for ShareMode, plus Lock, DoubleLock and DoubleLockEX for locking. In all cases it is ALWAYS possible to open the locked file in the second instance of Parallels.
Since locking is working in two instances of the same program in the same Parallels VM this demonstrates that Windows file locking IS working on the OSX share. My guess is that what is happening is that Parallels is cacheing the file reads in each VM to speed up read/write operations and not updating the cache when the file is changed in the other VM. So when I "access" the file in the second VM I am actually accessing the cached read-ahead copy, which does not yet have a file lock on it.
Unfortunately, this "unlocked" state persists when the file is written, making it possible for two instances of programs in two VMs to trash each other's writes by overwriting them, even though the files are officially locked.
If this is what is happening it would be quite a serious bug and security hole. Can anyone confirm this?