Re: explicit dcache <-> user-space cache coherency, sys_mark_dir_clean(), O_CLEAN

Linus Torvalds
2004-02-20T18:18:20Z

On Fri, 20 Feb 2004, Jamie Lokier wrote:
>
> How about this: we clean up dnotify, so it can be used for
> user<->kernel dcache coherency

No can do.

There is no _way_ dnotify can do a race-free update, exactly because any
user-level state is fundamentally irrelevant because it isn't tested under
the directory semaphore.

See? You can have a user-level cache, but the flag and the notification
absolutely has to be under the inode semaphore (and thus in kernel space)
if you want to avoid all races with unrelated processes.

Now, for samba this isn't necessarily a huge problem, because you can
basically say "don't do that, then", and just document that you shouldn't
mess with a samba export using anything but SMB accesses. So in a sense,
the samba unix-side coherency is nothing more than politeness, and then
dnotify or similar works fine (by virtue of not being an absolute
coherency guarantee, just a "best effort").

But then it should be documented as such. It's not coherent, it's only
"almost coherent".

Linus