[Cluster-devel] [PATCH v4 1/8] iov_iter: Introduce iov_iter_fault_in_writeable helper
torvalds at linux-foundation.org
Sat Jul 24 20:37:09 UTC 2021
On Sat, Jul 24, 2021 at 1:26 PM Al Viro <viro at zeniv.linux.org.uk> wrote:
> On Sat, Jul 24, 2021 at 12:52:34PM -0700, Linus Torvalds wrote:
> > So I think the code needs to return 0 if _any_ fault was successful.
> s/any/the first/...
Yes, but as long as we do them in order, and stop when it fails, "any"
and "first" end up being the same thing ;)
> The same goes for fault-in for read
Yeah. That said, a partial write() (ie "read from user space") might
be something that a filesystem is not willing to touch for other
reasons, so I think returning -EFAULT in that case is, I think,
slightly more reasonable.
Things like "I have to prepare buffers to be filled" etc.
The partial read() case is at least something that a filesystem should
be able to handle fairly easily.
And I don't think returning -EFAULT early is necessarily wrong - we
obviously do it anyway if you give really invalid addresses.
But we have generally strived to allow partial IO for missing pages,
because people sometimes play games with unmapping things dynamically
or using mprotect() to catch modifications (ie doing things like catch
SIGSEGV/SIGBUS, and remap it).
But those kinds of uses tend to have to catch -EFAULT anyway, so I
guess it's not a big deal either way.
More information about the Cluster-devel