Word and Excel need byte range locking, don't they

Jeremy Allison jra at samba.org
Thu May 27 17:10:23 GMT 2004


On Thu, May 27, 2004 at 10:12:41AM -0700, Richard Sharpe wrote:
> Hi,
> 
> This would be funny if it weren't so sad.
> 
> When word opens a file there is an enormous amount of activity. It opens
> the file, reads it, closes it, opens it again, and so on. At some point it
> takes out byte-range locks way beyond the end of the file (OLE?) and
> unlocks a different range of bytes also beyond the end of the file.
> 
> So, you need byte range locks, or do you? (Don't ask why this question
> arose, just read between the lines.)
> 
> It turns out that there are two different ways to avoid the need for byte
> range locks (ie, you can return STATUS_NOT_IMPLEMENTED and get away with
> it) at least for Word and Excel.
> 
> At some point during the dance that word does with the file server, it
> opens the same file a second time and asks for an OpLock on the file
> again. As long as Word gets the OpLock on the first file, and it is broken
> on the second open, refusing the byte-range lock does not matter.
> 
> Even more interesting, returning STATUS_SHARING_VIOLATION on the second
> open also allows Word to work without the need for byte-range locks.

Ok, so do we have a bug here ? This is unclear in your message :-)


More information about the samba-technical mailing list