Bug 10184 - New files aren't shown on Windows
Summary: New files aren't shown on Windows
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: File services (show other bugs)
Version: 3.6.19
Hardware: x64 Windows 7
: P5 major
Target Milestone: ---
Assignee: Volker Lendecke
QA Contact: Samba QA Contact
Depends on:
Reported: 2013-10-05 10:10 UTC by Marc Muehlfeld
Modified: 2015-03-11 03:38 UTC (History)
2 users (show)

See Also:

level 10 debug log (45.35 KB, application/octet-stream)
2013-10-05 10:11 UTC, Marc Muehlfeld
no flags Details
wireshark capture (44.01 KB, application/octet-stream)
2013-10-05 10:11 UTC, Marc Muehlfeld
no flags Details
smb.conf (7.35 KB, text/plain)
2013-10-05 10:12 UTC, Marc Muehlfeld
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Muehlfeld 2013-10-05 10:10:56 UTC
When a file is placed on a Samba share, it isn't shown for a while on other Windows machines, when they have this folder already open in explorer.

Steps to reproduce:

- On a Windows workstation: Open a directory on a Samba server in Windows Explorer. You will see the content, if there's any. Leave the window opened.

- On the Samba server or on a different workstation: Navigate to exactly this directory and download a new file to that folder.

- On the Windows workstation again: The new file does not appear. Even if you press [F5]. After a some minutes, the file appears.

(This are the steps I've done in the attached level 10 debug log file and the wireshark capture. The file I downloaded on the server to that folder and doesn't appear on windows was "test.log". The folder I used for testing was \\genome\homedirs\muehlfeld\Downloads\).

Further steps:

- Delete the file on windows. It's gone (like expected).

- Leave the directory open in Windows explorer.

- Download the file on the server again to that folder.

- The file appears directly if you press [F5] on the windows machine.

- Remove the file again.

- Close the Windows Explorer, reopen it and navigate again to that folder.

- Download the file on the server again to that folder.

- The file isn't shown again for a while.

Additional information:
- I can reproduce this on Windows 7 64-Bit with all updates (32-Bit not tested), but not on XP.
- It was reproducable against some (not all) of my 3.6.18 and 3.6.19 member servers. I attached the smb.conf from one of these machines.
- I could not reproduce it on my 4.0.9 DC (don't have 4.x members in production yet).
Comment 1 Marc Muehlfeld 2013-10-05 10:11:25 UTC
Created attachment 9252 [details]
level 10 debug log
Comment 2 Marc Muehlfeld 2013-10-05 10:11:42 UTC
Created attachment 9253 [details]
wireshark capture
Comment 3 Marc Muehlfeld 2013-10-05 10:12:01 UTC
Created attachment 9254 [details]
Comment 4 Marc Muehlfeld 2013-10-05 10:20:31 UTC
The problem is even greater if somebody renames a file or folder. Then on other machines, the file/folder is sometimes shown with it's old name (but of course not accessable any more) or completely gone for a time.
Comment 5 Marc Muehlfeld 2013-10-05 13:07:27 UTC
Something more that I have discoverd:

If client A has folder X openend and client B add/rename a file or directory, then the changes are not visible on client A for some time. But when client A does any change in the same folder (like delete some other file) and presses [F5] then, the change from client B appears (but only if [F5] was pressed afterwards). Only pressing [F5] doesn't work. It looks like the client doesn't request for the new directory content on a normal refresh.
Comment 6 Marc Muehlfeld 2013-10-05 15:50:20 UTC
I found out the following:

When I remove
   max protocol = SMB2
from my smb.conf and restart Samba, the problem seems to be gone (but I had to restart my Win7 workstation, too).

If the problem is related to SMB2, this would explain, why I didn't had this issue on XP machines (SMB2 was introduced in Vista).
Comment 7 Marc Muehlfeld 2013-10-06 09:22:50 UTC
I got a hint on the mailing list, that this problem is based on SMB2 caching in Windows7:

Am 06.10.2013 09:02, schrieb Jones:
> Sometimes this symptom happened in my environment,
> and found this link:
> SMB2 Client Redirector Caches Explained
> http://technet.microsoft.com/zh-tw/library/ff686200(v=ws.10).aspx
> Here is one test case,
> during Windows 7 and Samba are negotiated with >=  protocol SMB 2.0,
> Windows 7 might cache the directory entries,
> i.e. the directory entries are locally satisfied by Windows 7,
> and there are no SMB2 packets across network while refreshing the list thru
> powershell dir command,
> hence Windows 7 with Wireshark captures no packets.
> After following 3 DWORDs are applied to Windows 7 and reboot is required,
> this symptom seems no longer exist in my environment.
> Not sure is this a acceptable change but hope this help.
> FileInfoCacheLifetime = 0
> FileNotFoundCacheLifetime = 0
> DirectoryCacheLifetime = 0

If I add this three values to my registry and reboot, the problem is 
immediately gone.

So this bug report can be closed, as it isn't a Samba bug.