Re: [PATCH 2/3] afs: Fix afs_write_end() to handle short writes

From: Matthew Wilcox
Date: Mon Jun 14 2021 - 09:46:42 EST


On Mon, Jun 14, 2021 at 02:37:12PM +0100, David Howells wrote:
> Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> > > (1) If the page is not up to date, then we should just return 0
> > > (ie. indicating a zero-length copy). The loop in
> > > generic_perform_write() will go around again, possibly breaking up the
> > > iterator into discrete chunks.
> >
> > Does this actually work? What about the situation where you're reading
> > the last page of a file and thus (almost) always reading fewer bytes
> > than a PAGE_SIZE?
>
> Al Viro made such a change for Ceph - and we're writing, not reading.

I'd feel better if you said "xfstests doesn't show any new problems"
than arguing to authority.

I know the operation which triggers this path is a call to write(),
but if, say, the file is 32 bytes long, not in cache, and you write
bytes 32-63, the client must READ bytes 0-31 from the server, which
is less than a full page.