Bug 8602 - Windows7 + Offline Files (+Oplocks) = MSOffice file saving problem
Summary: Windows7 + Offline Files (+Oplocks) = MSOffice file saving problem
Status: NEW
Alias: None
Product: Samba 3.5
Classification: Unclassified
Component: File services (show other bugs)
Version: 3.5.12
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Volker Lendecke
QA Contact: Samba QA Contact
Depends on:
Reported: 2011-11-11 15:55 UTC by joschibrauchle
Modified: 2017-03-31 06:50 UTC (History)
3 users (show)

See Also:

smb.conf (504 bytes, application/octet-stream)
2011-11-11 15:55 UTC, joschibrauchle
no flags Details
Debug log level 10 (742.09 KB, application/octet-stream)
2011-11-11 16:06 UTC, joschibrauchle
no flags Details
Debug log level 10 with oplocks disabled (1.46 MB, application/octet-stream)
2011-11-11 16:14 UTC, joschibrauchle
no flags Details
offline-files.pcapng (554.57 KB, application/x-pcapng)
2017-03-31 06:41 UTC, Karli Sjöberg
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description joschibrauchle 2011-11-11 15:55:25 UTC
Created attachment 7091 [details]

- SLES11SP1 Server with SAMBA 3.5.12 (from Sernet). Samba is configured with just one writable share (see attached config)
- Windows 7 (Enterprise) PC connects to this share and makes is "always available" using offline files (now sync center). With MSOffice 2010 (2007 not tested), we create a new .docx file on the share, make some changes and save it a couple of times to this share.

Lots of XXXXXXX.TMP files created by Office. The docx file is still "seen" by the client, but most likely only due to its offline version, it is not actually on the server.

a) Disable offline files on the client. Then everything is back to normal, but no offline files available :-)
b) Disable oplocks on the server using 
       oplocks = no
       level2 oplocks = no
in smb.conf and restart Samba.

Using a Windows 2008R2 share, the same scenario works fine.

I will provide a level 10 debug log from Samba soon.
Comment 1 joschibrauchle 2011-11-11 16:06:50 UTC
Created attachment 7092 [details]
Debug log level 10

Scenario: The Windows 7 client is connected to the share and has it "always available offline".

The debug log starts after the new file "New Microsoft Word Document.docx" has been successfully opened by MS Word. I put some text and hit save (CTRL-S). 

The original docx disappears on the server and a file named "1038F1DB.TMP" remains.
Comment 2 joschibrauchle 2011-11-11 16:14:16 UTC
Created attachment 7093 [details]
Debug log level 10 with oplocks disabled

Same procedure as before, but with oplocks disabled on the SAMBA side. Now file saving works normally!
Comment 3 Jeremy Allison 2011-11-11 18:21:50 UTC
Do you get the same problem if you set "kernel oplocks = no" ?

Comment 4 joschibrauchle 2011-11-14 09:06:34 UTC
(In reply to comment #3)
> Do you get the same problem if you set "kernel oplocks = no" ?
> Jeremy.

Hello Jeremy,
so I just tested (smb.conf)
kernel oplocks = no
# oplocks = no
# level2 oplocks = no
and I still have the problem. Is that what you meant?
Comment 5 Yu-Fang Wang 2012-04-27 06:55:51 UTC
It seems that this issue also exists in 3.6.3.
Is there any workaround?
Comment 6 Karli Sjöberg 2017-03-30 11:30:13 UTC

This is something we have been able to reproduce accurately in two completely different environments, with both samba-4.3.13 and samba-4.4.8 in FreeBSD. The steps to reproduce are:
1. Online, make sure to sync, without conflicts.
2. Go offline (Wait for Sync Center to go opaque and and the folder in explorer to reach status "Offline Status: Offline (not connected)").
3. Create a new MS Word document in the "Always available offline" enabled share and open the document in Word.
4. Type in some data and _with_the_document_still_open_, save.
5. Go online again (Wait for the "Sync All" button to reappear and the folder in explorer to reach status "Offline Status: Online").
6. Type in some more data, then _save_and_close_the_document_.
7. Watch how folder status temporarily goes to offline status for a while before going online again, then the document disappears and gets renamed to "([A-Z0-9]+).tmp"

100% reproducible. How can we help to get this resolved?

Best Regards
Karli Sjöberg
Comment 7 Jeremy Allison 2017-03-31 00:05:08 UTC
Can you get a wireshark trace of this problem happening please ?
Comment 8 Karli Sjöberg 2017-03-31 06:41:34 UTC
Created attachment 13129 [details]
Comment 9 Karli Sjöberg 2017-03-31 06:50:14 UTC
Absolutely! I have uploaded a wireshark trace of the procedure from mapping the share, up to when the file gets renamed in the file called "offline-files.pcapng"

Best Regards
Karli Sjöberg