Re: [PATCH v4 37/39] netfs: Optimise away reads above the point at which there can be no data

David Howells
2023-12-19T16:56:49Z

Jeff Layton <jlayton@kernel.org> wrote:

> > (4) On local truncation up, we don't change zero_point.
> >
>
> The above seems odd, but I guess the assumption is that if there are any
> writes by a 3rd party above the old zero point, that that would cause an
> invalidation?

All truncating up does is extend the region from which reading would return
zeros, so it doesn't affect the zero_point.

If a third party interferes, then we have to invalidate the local caches and
reset zero_point to the EOF. But if a third party is writing to the file at
the same time as you without both of you using locking or exclusive direct
writes, your data is probably screwed anyway...

Something cifs and ceph can use leasing to make this work; afs uses the data
version number, notifications and the principle that you should use file
locks.

David