vfs_stat called but ignored when client has dir open

Andrew Klaassen clawsoon at yahoo.com
Mon Apr 23 13:27:18 MDT 2012

--- On Mon, 4/23/12, Jeremy Allison <jra at samba.org> wrote:

> On Mon, Apr 23, 2012 at 11:00:25AM
> -0700, Andrew Klaassen wrote:
> > I've got a VFS stat function that replaces the mtime on
> > a directory with the mtime from another directory.  It
> > works as designed except when the client has the directory
> > open in another window.  In that case, the VFS function
> > does the right thing, but its result is ignored and the
> > client always gets the mtime that the directory had when the
> > client first opened it.
> > 
> > Is this a feature, a bug, or me screwing something up?
> Try catching the VFS_FSTAT function as well as the
> That might be the problem.

[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.


More information about the samba-technical mailing list