Jablonovsky Alexander
2005-Sep-16 01:21 UTC
[Samba] incorrect shared access to the file - samba oplock bug?
I have tried to read a file from a Windows machine, at time this file being written from a Linux machine with Samba (constantly reading constantly growing file) and got a strange behavior. After reading some number of bytes ReadFile() starts to return 0 bytes read (EOF). Seeking and even closing/reopening the file doesn't help - only the old snapshot of the file can be read. Touching the file from other program like Explorer has effect - Windows refreshes the file to it's current state. The file is opening from Windows as follow: CreateFile(file_name, GENERIC_READ, FILE_SHARE_WRITE, (LPSECURITY_ATTRIBUTES)NULL, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN, (HANDLE)NULL)) Samba v. 2.2.7a, Linux kernel v. 2.4.20, oplock parameters - default. The effect is same in Windows 98 and XP. Please help!
Jeremy Allison
2005-Sep-16 04:09 UTC
[Samba] incorrect shared access to the file - samba oplock bug?
On Thu, Sep 15, 2005 at 03:31:49PM +0400, Jablonovsky Alexander wrote:> I have tried to read a file from a Windows machine, at time this file > being written from a Linux machine with Samba (constantly reading > constantly growing file) and got a strange behavior. After reading some > number of bytes ReadFile() starts to return 0 bytes read (EOF). Seeking > and even closing/reopening the file doesn't help - only the old snapshot > of the file can be read. Touching the file from other program like > Explorer has effect - Windows refreshes the file to it's current state.oplocks - either use kernel oplocks or turn off oplock support in Samba. Also to do this correctly you need byte range lock coordination between the reading and writing app. Jeremy.