> On what? ITYM truncate(), right? Metadata doesn't end up in the page
> cache, so... ->flushpage() set to block_flushpage() should be OK, but it
> will not be enough. All stuff with truncate()/write() is racey right now,
> AFAICS. The next thing I'm going to do is a (dumb) implementation of
> blocking rwlocks. write() being reader and truncate() - writer.
>
> Oh, crap! Add
Doing flushpage is good thing. But there's another posibility of data
corruption.
You have a directory and change something in it - there are dirty hashed
buffers covering directory.
You erase that directory - as there is no bforget, there are still dirty
hashed buffers.
You alloc file at that place. Buffers containing former directory are
flushed over the file.
I think bforget must be called always when you release some structure that
was accessed using bread/brelse.
Mikulas Patocka