shared stat cache

tridge at samba.org tridge at samba.org
Fri Nov 12 05:46:10 GMT 2004


Volker,

I've been doing some more investigation of the excel 2003 problem and
delayed update of the write_time field. While you do have a workaround
for the moment (using a wildcard oplock disable), I don't like that as
a long term solution.

The method I have used is this:

  - WindowsXP -> Samba4/cifs-proxy -> w2k3

As we discussed before, this combination works fine, and it passes
your RAW-WRITE delayed write test as well as the excel 2003 test. 

The new data I have comes from modifying the cvfs_write() call in
ntvfs/cifs/vfs_cifs.c like this:

    --- ntvfs/cifs/vfs_cifs.c       (revision 3688)
    +++ ntvfs/cifs/vfs_cifs.c       (working copy)
    @@ -536,8 +536,14 @@
		    return ntvfs_map_write(req, wr, ntvfs);
	    }

    -       if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
    -               return smb_raw_write(private->tree, wr);
    +       if (1 || !(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
    +               NTSTATUS status;
    +               struct smb_flush fl;
    +
    +               status = smb_raw_write(private->tree, wr);
    +               fl.in.fnum = wr->writex.in.fnum;
    +               smb_raw_flush(private->tree, &fl);
    +               return status;
	    }


This small change uses smb_raw_flush() to force the backend server to
update its on-disk inode structures immediately on every write
call. With this change in place your RAW-WRITE test fails (as the stat
fields update immediately), but excel 2003 has no problems.

I have also been testing Longhorn with excel 2003 and with variations
on the RAW-WRITE delayed write test. I have found that longhorn
updates its stat fields more consistently and faster than w2k3, but
excel 2003 still has no problems with it. Longhorn still does have
some IO patterns that cause delayed update of stat information, but
they are less common than in w2k3.

>From this I have come to the conclusion that the delayed update of
stat fields in w2k3 server is just a windows bug, reflecting an
incoherent filesystem cache that Microsoft is working on fixing. I
don't think it is something that we should try and emulate.

I also have concluded that the delayed stat update has nothing to do
with the excel 2003 problem you observed. That doesn't mean I know
what _is_ the problem with excel 2003, it just means that it isn't the
problem we thought it was.

Cheers, Tridge


More information about the samba-technical mailing list