I'm exporting a directory tree from a Linux server to a Windows XP client over Samba. Sometimes, when files are modified on the Linux side, the Windows side keeps seeing an out-of-date version. It looks like the Windows client is keeping a cache and not refreshing that cache when the file has changed, though I don't know that this is the explanation. I have not knowingly turned on any option for aggressive caching.
Here's an example of confirming the issue: this is a transcript in a Cygwin shell on the Windows machine (the tree is mounted on
L: on the Windows client). The 547a… checksum (generated around 20:11:50) is the state of the file as it was around 19:50; but Windows still saw that stale version of the file at 20:11 even though it had been overwritten several times in the meantime. Calling
stat somehow caused the cache to refresh.
$ md5sum /cygdrive/l/path/to/file 547af1697a17d80190fd55e8119c6317 */cygdrive/l/path/to/file $ stat /cygdrive/l/path/to/file File: `/cygdrive/l/path/to/file' Size: 110949 Blocks: 1024 IO Block: 65536 regular file Device: deed201bh/3740082203d Inode: 8873405464413 Links: 1 Access: (0644/-rw-r--r--) Uid: (4294967295/????????) Gid: (4294967295/????????) Access: 2011-11-14 20:11:56.499630000 +0100 Modify: 2011-11-14 20:06:40.199630000 +0100 Change: 2011-11-14 20:06:40.199630000 +0100 Birth: 2011-11-14 20:06:40.000000000 +0100 $ md5sum /cygdrive/l/path/to/file 3373557393baf9e8952052a8ea7551ab */cygdrive/l/path/to/file
The server is Ubuntu 10.04 (Samba package version: 3.4.7~dfsg-1ubuntu3.8). The client is running Windows XP Pro (version 5.1.2600) with the latest patches AFAIK. Here's
/etc/samba/smb.conf minus comments;
L: is one of the home directories.
[global] workgroup = ACME server string = %h wins server = 192.0.2.41 dns proxy = no log file = /var/log/samba/log.%m max log size = 1000 syslog = 0 panic action = /usr/share/samba/panic-action %d security = user encrypt passwords = true passdb backend = tdbsam obey pam restrictions = yes unix password sync = yes passwd program = /usr/bin/passwd %u passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . pam password change = yes map to guest = bad user socket options = TCP_NODELAY usershare allow guests = yes [homes] comment = Home Directories browseable = no read only = no [printers] comment = All Printers browseable = no path = /var/spool/samba printable = yes guest ok = no read only = yes create mask = 0700 [print$] comment = Printer Drivers path = /var/lib/samba/printers browseable = no read only = yes guest ok = no
Ideally, I would like to fix this bug. Failing that, how can I reliably (and reasonably) flush the whatever cache is being kept? The file is being read from a Cygwin shell script.