From: Al Viro <viro@zeniv.linux.org.uk>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
cluster-devel@redhat.com, linux-kernel@vger.kernel.org,
Jan Kara <jack@suse.cz>, Matthew Wilcox <willy@infradead.org>
Subject: Re: [RFC 5/9] iov_iter: Add iov_iter_fault_in_writeable()
Date: Mon, 31 May 2021 17:12:31 +0000 [thread overview]
Message-ID: <YLUY/7pcFMibDnRn@zeniv-ca.linux.org.uk> (raw)
In-Reply-To: <20210531170123.243771-6-agruenba@redhat.com>
On Mon, May 31, 2021 at 07:01:19PM +0200, Andreas Gruenbacher wrote:
> Add the equivalent of iov_iter_fault_in_readable(), but for pages that
> will be written to.
>
> While at it, fix an indentation error in iov_iter_fault_in_readable().
> +int iov_iter_fault_in_writeable(struct iov_iter *i, size_t bytes)
> +{
> + size_t skip = i->iov_offset;
> + const struct iovec *iov;
> + int err;
> + struct iovec v;
> +
> + if (!(i->type & (ITER_BVEC|ITER_KVEC))) {
> + iterate_iovec(i, bytes, v, iov, skip, ({
> + err = fault_in_pages_writeable(v.iov_base, v.iov_len);
> + if (unlikely(err))
> + return err;
> + 0;}))
> + }
> + return 0;
> +}
> +EXPORT_SYMBOL(iov_iter_fault_in_writeable);
I really don't like that. Conflicts with iov_iter patches are not hard to
deal with, but (like fault_in_pages_writeable() itself) it's dangerous as
hell - fault-in for read is non-destructive, but that is *not*. Existing
users have to be careful with it and there are very few of those. Adding
that as a new primitive is inviting trouble; at the very least it needs
a big fat "Don't use unless you really know what you are doing" kind of
warning.
next prev parent reply other threads:[~2021-05-31 17:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-31 17:01 [RFC 0/9] gfs2: handle page faults during read and write Andreas Gruenbacher
2021-05-31 17:01 ` [RFC 1/9] gfs2: Clean up the error handling in gfs2_page_mkwrite Andreas Gruenbacher
2021-05-31 17:01 ` [RFC 2/9] gfs2: Add wrapper for iomap_file_buffered_write Andreas Gruenbacher
2021-05-31 17:01 ` [RFC 3/9] gfs2: Add gfs2_holder_is_compatible helper Andreas Gruenbacher
2021-05-31 17:01 ` [RFC 4/9] gfs2: Fix mmap + page fault deadlocks (part 1) Andreas Gruenbacher
2021-06-01 6:00 ` Linus Torvalds
2021-06-02 11:16 ` Andreas Gruenbacher
2021-06-11 16:25 ` Al Viro
2021-06-12 21:05 ` Al Viro
2021-06-12 21:35 ` Al Viro
2021-06-13 8:44 ` [Cluster-devel] " Steven Whitehouse
2021-05-31 17:01 ` [RFC 5/9] iov_iter: Add iov_iter_fault_in_writeable() Andreas Gruenbacher
2021-05-31 17:12 ` Al Viro [this message]
2021-06-12 21:12 ` Al Viro
2021-06-12 21:33 ` Linus Torvalds
2021-06-12 21:47 ` Al Viro
2021-06-12 23:17 ` Linus Torvalds
2021-06-12 23:38 ` Al Viro
2021-05-31 17:01 ` [RFC 6/9] gfs2: Add wrappers for accessing journal_info Andreas Gruenbacher
2021-05-31 17:01 ` [RFC 7/9] gfs2: Encode glock holding and retry flags in journal_info Andreas Gruenbacher
2021-05-31 17:01 ` [RFC 8/9] gfs2: Add LM_FLAG_OUTER glock holder flag Andreas Gruenbacher
2021-05-31 17:01 ` [RFC 9/9] gfs2: Fix mmap + page fault deadlocks (part 2) Andreas Gruenbacher
2021-06-01 5:47 ` Linus Torvalds
[not found] ` <CAHk-=wgX=fZ+y=SxBsod8CvZmZ0-X7vZ6dV6EgLPkpBXbt=nQQ@mail.gmail.com>
2021-05-31 20:35 ` [RFC 0/9] gfs2: handle page faults during read and write Andreas Gruenbacher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YLUY/7pcFMibDnRn@zeniv-ca.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=agruenba@redhat.com \
--cc=cluster-devel@redhat.com \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox