Re: Metadata writtenback notification? -- was Re: fscache: Redesigning the on-disk cache

From: Matthew Wilcox
Date: Mon Mar 08 2021 - 18:22:05 EST


On Tue, Mar 09, 2021 at 09:32:47AM +1100, Dave Chinner wrote:
> On Mon, Mar 08, 2021 at 11:28:41AM +0000, David Howells wrote:
> > Possibly it's sufficient to just clear the excess page space before
> > writing, but that doesn't necessarily stop a writable mmap from
> > scribbling on it.
>
> We can't stop mmap from scribbling in it. All filesystems have this
> problem, so to prevent data leaks we have to zero the post-eof tail
> region on every write of the EOF block, anyway.

That's certainly one approach. Another would be to zero it during the I/O
completion handler. It depends whether you can trust the last writer or
not (eg what do we do with an isofs file that happens to contain garbage
after the last byte in the file?)