File locking

Benjamin Scott bscott at hamptonsys.com
Thu Dec 24 15:42:57 GMT 1998


On Wed, 23 Dec 1998, Joel Knight wrote:
> I have samba 1.9.18p10 running on a Linux 2.0.34 box serving win95 and 98
> clients. My problem arises with file locking. When one of the clients 
> opens a file, smbstatus shows the file as being open and locked which is
> fine. When one of the clients saves the open file, smbstatus no longer
> shows the file as being open. Is that normal behavior? Also, if a client
> opens a file, and then closes it without saving, smbstatus shows that the
> file is still opened. Is this also normal?

  I do not know if that is intended behavior, but I seen similar behavior
here.  I first noticed it when I opened a Perl CGI script for editing in my
favorite (DOS based) editor.  Samba listed that file as locked, which makes
some sense [1].  I saved it, exited, and tried to run the script, and it
failed with "Text file busy".  Sure enough, Samba was still listing that file
as open and locked, even though I had exited that editor, and even the DOS
window that spawned it!

  [1] But not a lot, since my editor is configured to only open the files when
actually reading/saving from/to the file.

  At first, I could not get Samba to close the file without logging out or
rebooting the 'doze client.

  Then I noticed something weirder -- and more worrisome.  If I run a program
(Microsoft Source Safe, as it happens) that opens a lot of files, Samba seems
to "forget about" the locks opened on previous files.  It is as if the locks
are maintained in a fixed-size table, and LRU locks fall off the end of the
table.

  This behavior occurred both on a Win98 (new install) and a Win NT 4.0 SP4
Workstation client.

  So, I have multiple concerns.  First, why does Samba maintain locks even
after the client has closed the file?  Second, do mandatory exclusive locks
requested by the client also fall out of the lock table?  I sure hope not!

  I want to look into this further, but I will not have time to do that until
mid-January at the earliest.  In the mean time, maybe this information will
help somebody.  :)

  Configuration highlights:
  - Linux kernel 2.0.35
  - Base distributionL: Red Hat Linux 5.1
  - Samba is 1.9.18p10, compiled from pristine sources
  - PAM is in use
  - dns proxy = true
  - wins support - true
  - {domain|local|preferred} master = true
  - oplocks = true
  - read prediction = true
  - strict locking = true
  - encrypt passwords = true

  I can provide full configuration files, log files at the debug level of your
choice, smbstatus dumps, or whatever, on request. 

  Have a nondenominational event of a nature you prefer.  :-)

----------------------------------------------------------------------
Benjamin Scott <bscott at hamptonsys.com>          Phone: (603)431-7315
Hampton Systems Group, Inc.                     Fax  : (603)431-0822
http://www.hamptonsys.com                       DSN  : 852-3581
======================================================================



More information about the samba mailing list