[Samba] 'document has been locked for editing by another user' - medium latency / limited bw connection issues?

Bram Matthys syzop at vulnscan.org
Mon Mar 17 11:21:36 MDT 2014


I hope some of you have been in a similar situation and can shed some light
on this:

I have a VPN connection to a Samba 4.1.4 server and when I use Word 2010 on
a W7 client to open an existing file I often get the following error:
"document.docx has been locked for editing by another user."
I should clarify that the document is not in use by anyone (confirmed by
smbstatus), and this happens on several documents.. including ones I just
created minutes ago myself.

I get this either 1) directly before I see the document (rarely), or 2)
after I clicked on 'Enable editing' due to being in 'Secure Display' mode
('this file is from an internet location and is possibly unsafe').

I found out that if I wait long enough after opening the document, say: 10
seconds to be safe, then I can pretty much always click on 'Enable Editing'
and edit the document without any errors.
I then used tcpdump, and there's indeed still a lot of traffic after I see
the document (but before I click 'enable editing'). If I wait for the
traffic to settle, then I can open the document with no problems.

I disabled the 'Windows Search' (Indexing) service, I temporarily disabled
my anti-virus software... because I suspected either of them could be
accessing the file and thus causing a locked file, but it all didn't help.

The connection itself has a ping of around 20ms (I suppose that isn't high
latency, but much higher than LAN, anyway), and a bandwidth of xxx kb/s. The
test document is just 13kB, though.

Before I realized I simply had to wait, I started playing with 'strict
locking = no', 'kernel oplocks = no', 'kernel share modes = no', even to the
point of 'locking = no' (but that's dangerous). This all didn't help.
Actually disabling oplocks seemingly made the issue even worse, perhaps due
to Windows no longer caching the file and thus requiring more bandwidth /
packets = longer delay before I can use the file.

My question: is there any setting I can tweak to resolve or workaround this
issue? Either on the Samba side, or the Windows client side.

I can edit .txt files with notepad without any problems, but then again
notepad doesn't do any locking..

On a LAN pc I don't have any locking issues.

I would be surprised if I were the only one with this issue, VPN to Samba
and the use of Microsoft Office should all be quite common :)



Bram Matthys
Software developer/IT consultant        syzop at vulnscan.org
Website:                                  www.vulnscan.org
PGP key:                       www.vulnscan.org/pubkey.asc
PGP fp: EBCA 8977 FCA6 0AB0 6EDB  04A7 6E67 6D45 7FE1 99A6

More information about the samba mailing list