Henrik Nordström wrote:
But I do not agree entirely on the conclusions on how mod_dav should
handle ETag. If you store ETag as a property it's better you generate a
real strong ETag without relying on the filesystem meta data, only using
the filesystem meta data as a safety check to guard from direct
filesystem modification not using WebDAV.
You would still suffer from the 1 second racing condition where you
wouldn't known if your stored ETag was up-to-date due to the mtime
resolution (for modifications made outside of WebDAV) forcing you back
into the current weak ETag situation.
A correct implementation would have to regenerate the strong ETag for
all of these sub second occurring requests (which is counter intuitive
for a cached property and also very inefficient).
The other proposals I've been reading seem to require saying that this
ETag is strong when we know that this it not guaranteed to be true - but
perhaps this should be up to the admin (DavETagIsolation dav-mods-only).
If we had some way of getting (outside) file modification events we
could have a very strong implementation using the inode, mtime and a
generation counter (with an n microsecond race between a change and
delivery of its change event to some sort of file modification or
stat-cache).
We could use something like inotify (or pnofity [1]) to track these
files for the required 1 second duration (or for a longer duration if we
wished to cache the stat info and know for sure it was valid). It seems
like an ugly thing to do but seems to me to be the only way we could
guarantee we know that the file has not been modified with the coarse
mtime we have. Of course it would be non-trivial and require quite a bit
of infrastructure (say a VFS statcache module using a portable file
system event notification API).
~mc
[1] http://mark.heily.com/pnotify/
pnotify is a BSD licensed portable file systems event notification
library that works across Linux, *BSD and OS X. It is noted by the
author that it could also be supported on Windows and Solaris, as they
have filesystem notification event subsystems also.