[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <466590.1623677832@warthog.procyon.org.uk>
Date: Mon, 14 Jun 2021 14:37:12 +0100
From: David Howells <dhowells@...hat.com>
To: Matthew Wilcox <willy@...radead.org>,
Al Viro <viro@...iv.linux.org.uk>
Cc: dhowells@...hat.com, jlayton@...nel.org,
linux-afs@...ts.infradead.org, ceph-devel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] afs: Fix afs_write_end() to handle short writes
Matthew Wilcox <willy@...radead.org> 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 was thinking that it would break if reading from a pipe, but Jeff pointed
out that the iov_iter_advance() in generic_perform_write() uses the return
value of ->write_end() to advance the iterator. So it might loop endlessly,
but it doesn't appear it will corrupt your data.
David
Powered by blists - more mailing lists