[Samba] Prevent read locks on shares

John Gardeniers jgardeniers at objectmastery.com
Wed Jan 27 22:25:20 UTC 2016


I really don't know if this is a Samba or Linux issue but after 
migrating one of our file shares from a Samba 3 server to a Samba 4 
server we discovered a problem that never existed before. On this share 
we have a couple of ini files which is periodically read by a Windows 
application on client machines. The problem appeared when one of those 
files needed to be edited, which can happen several times a day. The 
write failed with an error message stating that the file was already 
opened by another user.

Using lsof I discovered that there was a read lock on the file. Up until 
yesterday I wasn't even aware of read locks, having never encountered 
them before. Googling only turns up some old articles on how locks can 
be implemented, but I can find nothing about preventing them.

The Windows application which reads the file simply opens it for read 
access and doesn't do anything fancy at all. How is the read lock 
applied? How can it be prevented? We have had to quickly switch back to 
the old server until this can be resolved.

regards,
John




More information about the samba mailing list