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

Lars Erik Kolden lars.erik.kolden at gmail.com
Fri Oct 17 07:48:42 GMT 2008

On Thu, Oct 16, 2008 at 6:30 PM, Jeremy Allison <jra at samba.org> wrote:
> Ok, the reason it works between XP -> XP is that the XP clients
> open with deny modes (not locking) that prevent two simultaneous
> read/write opens.
> The reason it works XP -> Linux is the same as the above. The
> XP client opens with DENY_WRITE, the Linux client opens with
> DENY_NONE - these modes conflict. Not a great error message,
> from the Gnome VFS open, but there you go. Probably doesn't
> know what to do with the lower level "sharing violation"
> error from libsmbclient.
> 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).
> So what happens is client1 opens with sharing mode
> DENY_NONE (typical Unix open), client2 opens with
> sharing mode DENY_NONE. There's no conflict.
> Now when this happens on a local Linux filesystem
> the OO clients do fcntl byte range locks after the
> open to do exclusion, and to tell if there's another
> client with this file open.
> Over Gnome VFS those fcntl lock calls get dropped
> on the floor - no way to remote them to the Samba
> server.
> The reason it works with CIFSFS is that CIFSFS
> will remote those lock requests correctly.
> So, get the local clients to mount the share
> on a local directory, and then it should work
> as the fcntl locks will get remoted for the Linux
> clients, and the share modes will protect you
> for the XP clients.
> Without locking support in Gnome VFS I don't think
> there's a way to properly do this using Gnome VFS.
> Jeremy.

Thanks, now I tried to mount directly in the filesystem with mount -t
cifs, but still no locking. I see later in this thread that OOo cross
platform locking is broken altogether. Anyway, here is the output from
smbstatus on the server (the part which applies to locks):

Locked files:
Pid          Uid        DenyMode   Access      R/W        Oplock
    SharePath   Name   Time
16413        5017       DENY_NONE  0x12019f    RDWR       NONE
    /home/test   testmappe/kjkjkjkjkj.odt   Fri Oct 17 09:43:03 2008
16366        5030       DENY_NONE  0x12019f    RDWR       NONE
    /home/test   testmappe/kjkjkjkjkj.odt   Fri Oct 17 09:43:26 2008


As you see, there is still no conflict.

Thanks for your thorough reply once again.

Best regards,

Lars Erik

More information about the samba mailing list