[Samba] Problems with file locking over gnome-vfs (esp. OpenOffice.org)

Volker Lendecke Volker.Lendecke at SerNet.DE
Thu Oct 16 16:59:25 GMT 2008

On Thu, Oct 16, 2008 at 09:48:00AM -0700, Jeremy Allison wrote:
> On Thu, Oct 16, 2008 at 06:49:54PM +0200, Volker Lendecke wrote:
> > > 
> > > The one that bites is Linux -> Linux. This is because
> > > the Gnome VFS has no locking primitives (not an expert
> > > on Gnome VFS so people with more knowledge feel free
> > > to contradict me).
> > 
> > Just FYI: I'm just coming from a customer with exactly this
> > problem using cifs.ko. OpenOffice 2 is just broken when it
> > comes to cross-platform locking. Period.
> Oh that's a shame. Doesn't it make any fcntl lock calls
> for exclusion ? I vaguely remember looking in the source
> code a while ago and thought it did so.

As you say Linux->Linux does fcntl locks, Win->Win does
share modes. Now you can make your own guess what happens if
Win opens first, then Linux: Linux cifs.ko gets a
SHARING_VIOLATION and returns ETXTBSY to OOo, which in turn
gives a nasty I/O error message to the user. Now a Linux
client opens first with DENY_NONE, does its fcntl lock,
Windows opens second. The open works, but due to the fnctl
lock and the mandatory locking semantics of Windows locks,
the read returns something like LOCK_CONFLICT or so. Again,
OOo (Win) is confused and returns something like "File
corrupt, do you want to repair?".

What they *should* have done is open with DENY_NONE and use
a byte range lock on a byte that is never accessed. This is
the only way I can imagine to work.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba/attachments/20081016/0d31cc94/attachment.bin

More information about the samba mailing list