vfs_stat called but ignored when client has dir open

Jeremy Allison jra at samba.org
Mon Apr 23 14:05:34 MDT 2012

On Mon, Apr 23, 2012 at 12:27:18PM -0700, Andrew Klaassen wrote:
> [tries] ...doesn't look like that's it; I'm getting the same behaviour with both stat and fstat intercepted.
> What's making me think "samba is caching" is the fact that the mtime Samba is sending for testdir isn't testdir's actual mtime (what I'd expect if stat or fstat was being called without being routed through my VFS module), and it isn't testdir.foo's current mtime (the behaviour that I want).
> The mtime Samba is sending for testdir is what testdir.foo's mtime ~was~ a few minutes ago when I first opened testdir in Windows Explorer.  Close that Windows Explorer window, and Samba suddenly starts sending testdir.foo's current mtime for testdir as desired.
> Here's something interesting: All clients get a cached mtime if any client has a testdir window open.  As soon as that window is closed, all clients can get the latest mtime.

Ah ok. Now I recall (thanks for reminding me :-). We do it
that was as it's the way Windows does it. We're caching
the mtime (write time) inside the share mode entry.

Look at the get_file_infos() call inside locking/locking.c,
and the cached time data on the 'struct share_mode_lock'.

You'll need to modify that if you want to affect mtime
on an open file.


More information about the samba-technical mailing list