[Samba] SMBMount Not Recognizing File Locks

Bob McLaren BobMcLaren at fssi-ca.com
Thu Feb 12 16:39:39 GMT 2004

I'm trying to set up a "dropbox" application that will monitor a
directory for newly created files and process them.  The problem I am
having is that my linux process is not recognizing that a file is
still being written to by another server.

Here's the configuration:
Redhat Linux with 2.4.9-31smp kernel using SAMBA 2.0.10 client to
mount a share that exists on a Windows 2000 server.

My linux process monitors that mounted drive, and once it sees a file,
begins processing it and then moves it off to an archive location.  If
the file is still being written to or being copied from another
location on the network, my process does not recognize it and assumes
that the file is ready for processing.  This results in corruption,
failures, etc...

I've tried using 'stat' to monitor the bytecount, but in the event an
NT file copy process is copying the file to this mounted location,
'stat' shows the "final" bytecount, as if the file has already been
completely written.
I've tried opening the file exclusively, expecting to receive a failure 
or timeout, but for some reason, it is
very easy for me to open the file exclusively in either read/write/or
append mode from Linux, even though NT is still trying to finish
copying the file to the dropbox location.

I have reviewed the manpage for smb.conf and their are plenty of
directives that manage file locking.  But they all seem to pertain to
the SMBD Server, not the client.

Any help or hints would be most appreciated.

Bob McLaren 

More information about the samba mailing list