From: Dave Hansen <dave.hansen@linux.intel.com>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,Ted Ts'o
<tytso@mit.edu>,Christian Brauner <brauner@kernel.org>,Darrick
J. Wong <djwong@kernel.org>,Matthew Wilcox (Oracle)
<willy@infradead.org>,Al Viro
<viro@zeniv.linux.org.uk>,linux-fsdevel@vger.kernel.org,Dave
Hansen
<dave.hansen@linux.intel.com>,dhowells@redhat.com,jlayton@kernel.org,netfs@lists.linux.dev
Subject: [PATCH 7/7] netfs: Remove outdated comments about prefaulting
Date: Wed, 29 Jan 2025 10:18:02 -0800 [thread overview]
Message-ID: <20250129181802.6E1E4149@davehans-spike.ostc.intel.com> (raw)
In-Reply-To: <20250129181749.C229F6F3@davehans-spike.ostc.intel.com>
From: Dave Hansen <dave.hansen@linux.intel.com>
I originally set out to make netfs_perform_write() behavior more
consistent with generic_perform_write(). However, netfs currently
treats a failure to make forward progress as a hard error and does not
retry where the generic code will loop around and retry.
Instead of a major code restructuring, just focus on improving the
comments.
The comment refers to a possible deadlock and to userspace address
checks. Neither of those things are a concern when using
copy_folio_from_iter_atomic() for atomic usercopies. It prevents
deadlocks by disabling page faults and it leverages user copy
functions that have their own access_ok() checks.
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Jeff Layton <jlayton@kernel.org>
Cc: netfs@lists.linux.dev
---
b/fs/netfs/buffered_write.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff -puN fs/netfs/buffered_write.c~netfs-postfault fs/netfs/buffered_write.c
--- a/fs/netfs/buffered_write.c~netfs-postfault 2025-01-29 09:03:38.167859749 -0800
+++ b/fs/netfs/buffered_write.c 2025-01-29 09:03:38.171860082 -0800
@@ -152,16 +152,9 @@ ssize_t netfs_perform_write(struct kiocb
offset = pos & (max_chunk - 1);
part = min(max_chunk - offset, iov_iter_count(iter));
- /* Bring in the user pages that we will copy from _first_ lest
- * we hit a nasty deadlock on copying from the same page as
- * we're writing to, without it being marked uptodate.
- *
- * Not only is this an optimisation, but it is also required to
- * check that the address is actually valid, when atomic
- * usercopies are used below.
- *
- * We rely on the page being held onto long enough by the LRU
- * that we can grab it below if this causes it to be read.
+ /* Bring in the user folios that are copied from before taking
+ * locks on the mapping folios. This helps ensure forward
+ * progress if they are the same folios.
*/
ret = -EFAULT;
if (unlikely(fault_in_iov_iter_readable(iter, part) == part))
_
next prev parent reply other threads:[~2025-01-29 18:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-29 18:17 [PATCH 0/7] Move prefaulting into write slow paths Dave Hansen
2025-01-29 18:17 ` [PATCH 1/7] filemap: Move prefaulting out of hot write path Dave Hansen
2025-01-29 18:17 ` [PATCH 2/7] iomap: " Dave Hansen
2025-01-31 7:59 ` Christoph Hellwig
2025-01-29 18:17 ` [PATCH 3/7] ntfs3: " Dave Hansen
2025-01-29 18:17 ` [PATCH 4/7] fuse: " Dave Hansen
2025-04-15 8:43 ` Miklos Szeredi
2025-01-29 18:17 ` [PATCH 5/7] bcachefs: " Dave Hansen
2025-01-29 18:18 ` [PATCH 6/7] btrfs: " Dave Hansen
2025-01-29 18:18 ` Dave Hansen [this message]
2025-01-30 7:44 ` [PATCH 0/7] Move prefaulting into write slow paths Kent Overstreet
2025-01-30 16:04 ` Dave Hansen
2025-01-30 21:36 ` Dave Chinner
2025-01-31 1:06 ` Kent Overstreet
2025-01-31 0:56 ` Kent Overstreet
2025-01-31 1:34 ` Dave Hansen
2025-01-31 2:17 ` Kent Overstreet
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=20250129181802.6E1E4149@davehans-spike.ostc.intel.com \
--to=dave.hansen@linux.intel.com \
--cc=brauner@kernel.org \
--cc=dhowells@redhat.com \
--cc=djwong@kernel.org \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netfs@lists.linux.dev \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
--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
all inboxes | Powered by JetHome®