[plug] Samba locking

Ian Kent raven at themaw.net
Thu May 8 13:05:16 WST 2008

On Tue, 2008-05-06 at 23:15 +0800, Nathan Alberti wrote:
> I'm having a small samba (3.0) issue with file locking.
> The objective is to have a directory that has files written to it by a
> unix process that is shared out via an SMB share. The share is polled
> periodically by a process on a windows machine and if a particular
> file/s exists it is processed and removed... not the best design but
> not my doing.
> The problem I need to overcome is that the file is being processed
> before it has been completely written out to the file system and
> therefore attempting to be processed when incomplete.
> I have tried disabling oplocks and also veto oplocks for the
> particular file suffix but I am still able to move/delete the file
> while the file is still being written too.

Doesn't the removal or move depend on the directory not the file itself?

To deal with this race both the producer and the consumer need to

Have a look at lockfile(1) maybe that will help.


More information about the plug mailing list