[Samba] Local File Locking Doesn't Work

Dana Lacoste dana.lacoste at peregrine.com
Tue Jun 24 17:58:19 GMT 2003

When writing a (1MB+) file to my samba share, I can lock the
file locally (from Delphi) which seems kinda really horrible.

Meaning this happens :

Windows machine : Copy large-ish file to samba share
Linux server : check for file; when file is created, open file and
               read contents.  validate contents to ensure file
               is OK.  (As file has not completed writing yet)
               validation fails.

Is there a way to make samba to lock files so that nobody on the
linux side can take that lock away?  Like, perhaps, some way that
doesn't involve changing what the windows users do?

It seems to me that basic file locking should be fairly important
to samba, so I'm fairly sure that I'm doing something wrong if it's
not working (there's no way that this would have been overlooked, is

Dana Lacoste
Ottawa, Canada

my smb.conf (I added the strict and level2 commands to try to fix it) :
	max connections = 10
	load printers = no
	encrypt passwords = yes
	case sensitive = no
	change notify timeout = 300
	deadtime = 15
	security mask = 0000
	follow symlinks = no
	force group = share
	inherit permissions = yes
	log file = /var/log/smbd
	map archive = no
	max log size = 0
	nt acl support = no
	time server = yes
	strict sync = yes
	level2 oplocks = yes
	strict locking = yes

	workgroup = WORKGROUP

	path = /data/pcdata/share
	comment = Scan utilities and files
	writeable = true

More information about the samba mailing list