[Cluster-devel] [PATCH v4 1/8] iov_iter: Introduce iov_iter_fault_in_writeable helper
Al Viro
viro at zeniv.linux.org.uk
Sat Jul 24 20:24:17 UTC 2021
On Sat, Jul 24, 2021 at 12:52:34PM -0700, Linus Torvalds wrote:
> ...
> > + if (fault_in_user_pages(start, len, true) != len)
> > + return -EFAULT;
>
> Looking at this once more, I think this is likely wrong.
>
> Why?
>
> Because any user can/should only care about at least *part* of the
> area being writable.
>
> Imagine that you're doing a large read. If the *first* page is
> writable, you should still return the partial read, not -EFAULT.
Agreed.
> So I think the code needs to return 0 if _any_ fault was successful.
s/any/the first/...
The same goes for fault-in for read, of course; I've a half-baked conversion
to such semantics (-EFAULT vs. 0; precise length is unreliable anyway,
especially if you have sub-page failure areas), need to finish and post
it...
More information about the Cluster-devel
mailing list