CIFS + NFS'ing a single filesystem w/ locking

Adam D. Morley adam-samba at
Thu Jan 12 19:08:38 GMT 2006


On Wed, Jan 11, 2006 at 07:14:33PM -0800, Jeremy Allison wrote:
> On Wed, Jan 11, 2006 at 06:24:12PM -0800, Adam D. Morley wrote:
> > Hi,
> > 
> > I sent the below two emails to the general inquiries list, but I didn't
> > get any replies.  I thought since I was discussing locking I might need
> > to post here.  The messages follow, my first post discussing Samba'ing
> > an NFS-exported UFS on Solaris, while my second email mentions an
> > attempt to get Samba to honor/see locks made on a Linux host's console.
> > 
> > Summary: locking doesn't seem to work.  I may be doing something wrong.
> > If so, what?  smb.conf is included for both hosts, in addition to
> > references to the code in OpenOffice's source tree.
> > 
> > Thanks a bunch!
> > 
> > ----- Forwarded message from "Adam D. Morley" <adam-samba at> -----
> > I have a Solaris 10 server exporting UFS directories using built-in NFS.
> > I've built Samba 3.0.20b from OpenPKG (  I have a
> > Solaris 10 (x86) client mounting the NFS share and opening OpenDocument
> > files using StarOffice 8 (SO8, aka OO2.0).  I also have a Windows 2003
> > Terminal Server mounting the Samba share and opening documents with SO8.
> > This is a temporary development environment, so I can screw around with
> > it.  I have a similar, production environment using RHEL3 (clients) and
> > Solaris 9 (server), with no Samba.  Ie: I would like to export NFS
> > shares as CIFS shares using Samba.  But: I want file locking.
> > 
> > StarOffice 8/OO2.0 support file locking, whereby the first user to open 
> > a file will place a lock* on the file, and the other users will get a 
> > read-only file.  This works fine with NFS & nlockmgr (cross platform, 
> > linux/solaris).  However, when I add Samba to the mix, it doesn't seem 
> > to see the locks.  I am under the impression this is because Solaris 
> > does not support kernel oplocks.  Here is my smb.conf:
> Yes, it's probably because Solaris doesn't support kernel oplocks so
> other processes on the box won't ever see the Windows client locks
> (they'll never be sent to the server if the client thinks it has an
> oplock). For solaris you'll have to turn off oplocks if you want
> this to work.

It's not just Windows client locks --- I set up a Linux machine (see the
second email) and opened a document with StarOffice 8 on the console.
This establishes a write lock (lock type of FWRLCK) on the file.  Then,
when Samba tries to open it for the Windows client, the Windows client
can't open the file.  If I close the file on the console, and then open 
it with the Windows machine (through Samba), it opens fine.  Opening it 
at the console then yields no message about a lock, and then the Windows
client again gets an I/O error.  This is with RHEL3ES's Samba, which
should be a locking-capable Samba server from what I've read.

Basically, I'm wondering why the locks don't propegate, and if there is
a way to find out what the I/O errors are.  I will probably start
stracing smbd, but before I started doing that I wanted to ask if my
config file settings:

workgroup = test
security = share
path = /shared2
read only = No
guest ok = yes
kernel oplocks = Yes
locking = Yes
oplocks = Yes
level2 oplocks = No

Should allow for locks on the console of the Linux machine to propegate
to Samba. . .



More information about the samba-technical mailing list