public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/24] netfs: Miscellaneous fixes
@ 2026-04-28 13:17 David Howells
  2026-04-28 13:17 ` [PATCH v5 01/24] netfs: Fix cancellation of a DIO and single read subrequests David Howells
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: David Howells @ 2026-04-28 13:17 UTC (permalink / raw)
  To: Christian Brauner
  Cc: David Howells, Paulo Alcantara, netfs, linux-afs, linux-cifs,
	ceph-devel, linux-fsdevel, linux-kernel

Hi Christian,

Here are the outstanding miscellaneous fixes for netfslib gathered together
and with some fixes-to-fixes folded down and one rearrangement.  Various
Sashiko review comments[1][2][3][4] are addressed:

 (1) Fix subrequest cancellation cleanup in DIO read and single-read.

 (2) Fix read and write result collection to use barriering correctly to
     access a request's subrequest lists without taking a lock.

     This adds list_add_tail_release() and
     list_first_entry_or_null_acquire() to appropriate incorporate
     barriering into some list functions.

 (3) Fix missing locking around retry adding new subrequests.

 (4) Fix netfs_read_to_pagecache() to pause on subrequest I/O failure.

 (5) Fix the potential for 64-bit tearing on a 32-bit machine when reading
     netfs_inode->remote_i_size and ->zero_point by using much the same
     mechanism as is used for ->i_size.

 (6) Fix the calculation of zero_point in netfs_release_folio() to limit it
     to ->remote_i_size, not ->i_size.

 (7) Fix triggering of a VM_BUG_ON_FOLIO() in netfs_write_begin().

 (8) Fix error handling in netfs_extract_user_iter().

 (9) Fix overrun checking in netfs_extract_user_iter().

(10) Fix a potentially uninitialised error value in
     netfs_extract_user_iter().

(11) Fix netfs_invalidate_folio() to clear the folio dirty bit if all dirty
     data removed.

(12) Defer the emission of trace_netfs_folio() in netfs_perform_write().
     This allows the next patch to emit the correct traces.

(13) Fix the handling of a partially failed copy (ie. EFAULT) into a
     streaming write folio.  Also remove the netfs_folio if a streaming
     write folio is entirely overwritten.

(14) Fix a potential deadlock in writethrough writing.

(15) Fix netfs_read_gaps() to remove the netfs_folio from a filled folio.

(16) Fix netfs_perform_write() to not disable streaming writes when writing
     to an fd that's open O_RDWR.

(17) Fix an early put of the sink page used in netfs_read_gaps(), before
     the request has completed.

(18) Fix request leak in netfs_write_begin() error handling.

(19) Fix a potential UAF in netfs_unlock_abandoned_read_pages() due to
     trying to check index of each folio we're abandoning to see if that
     folio is actually owned by the caller (in which case, we're not
     actually allowed to dereference it).

(20) Fix incorrect adjustment of dirty region when partially invalidating a
     streaming write folio.

(21) Fix the handling of folio->private in netfs_perform_write() and the
     attached netfs_folio and/or group when a streaming write folio is
     modified.

(22) Fix netfs_read_folio() to wait on writeback first (it holds the folio
     lock) otherwise we aren't allowed to look at the netfs_folio struct as
     that could be modified at any time by the writeback collector.

(23) Fix write skipping in dir/symlink writepages.

(24) Fix the locking used by afs_get_link().

The patches can also be found here:

	https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=netfs-fixes

Thanks,
David

[1] https://sashiko.dev/#/patchset/20260414082004.3756080-1-dhowells%40redhat.com
[2] https://sashiko.dev/#/patchset/20260326104544.509518-1-dhowells%40redhat.com
[3] https://sashiko.dev/#/patchset/20260425125426.3855807-1-dhowells%40redhat.com
[4] https://sashiko.dev/#/patchset/20260427154639.180684-1-dhowells%40redhat.com

Changes
=======
ver #5)
- Fix more Sashiko issues[4].
  - Handle missed cancellations in netfs_read_to_pagecache().
  - Fixed potential double dio-end/put if no subreqs were submitted in dio
    read.
  - In netfs_single_dispatch_read(), cancellation needs to set ALL_QUEUED
    and invoke the collector.
  - In read/write retry, lock around deletion of subreqs also.
  - Renamed list_first_entry_acquire() to
    list_first_entry_or_null_acquire().
  - In netfs_push_back_zero_point(), fix use of cmpxchg().
  - Provide netfs_write_remote_i_size_locked() that can be used by a func
    holding inode->i_lock (e.g. cifs_fattr_to_inode()).
  - In netfs_extract_user_iter(), improved overrun checking.
  - Added a patch to fix a potential deadlock with write-through writes.
  - In netfs_page_mkwrite(), skip the flush if no group set on the folio.
  - In the single-write users, mark the inode dirty again if a contended
    lock was skipped due to WB_SYNC_NONE.

ver #4)
- Rebase on v7.0-rc1
- Fix more Sashiko issues[3].
  - Move the ->subrequests barriering patch up front as it modifies
    linux/list.h.
  - Split that barriering patch and make the first patch to harmonise the
    order of adding a read subreq to the queue, for buffered, dio and
    single reads and to fix cancellation on prep failure.  The second patch
    then fixes the barriering.
  - Lock ->subrequests in retry when adding in extra subreqs.
  - Use a spinlock as well when modifying ->zero_point with a seq lock.
  - Atomically check and change ->zero_point when bumping it up.
  - Merged the two patches sorting out the locking in afs symlink handling,
    then fixed a number of issues in them.
- Added a patch to make afs dir and symlink writepages skip if the
  validate_lock is held and WB_SYNC_NONE is set.

ver #3)
- Rebase on linus/master.
- Consolidate the various sets of fixes for reposting.
- Fold down fixes-to-fixes.
- Move the tracing change in netfs_perform_write() down to below the patch
  it primarily affects.

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731

David Howells (22):
  netfs: Fix cancellation of a DIO and single read subrequests
  netfs: Fix missing locking around retry adding new subreqs
  netfs: Fix missing barriers when accessing stream->subrequests
    locklessly
  netfs: Fix netfs_read_to_pagecache() to pause on subreq failure
  netfs: Fix potential for tearing in ->remote_i_size and ->zero_point
  netfs: Fix zeropoint update where i_size > remote_i_size
  netfs: Fix overrun check in netfs_extract_user_iter()
  netfs: Fix potential uninitialised var in netfs_extract_user_iter()
  netfs: Fix netfs_invalidate_folio() to clear dirty bit if all changes
    gone
  netfs: Defer the emission of trace_netfs_folio()
  netfs: Fix streaming write being overwritten
  netfs: Fix potential deadlock in write-through mode
  netfs: Fix read-gaps to remove netfs_folio from filled folio
  netfs: Fix write streaming disablement if fd open O_RDWR
  netfs: Fix early put of sink folio in netfs_read_gaps()
  netfs: Fix leak of request in netfs_write_begin() error handling
  netfs: Fix potential UAF in netfs_unlock_abandoned_read_pages()
  netfs: Fix partial invalidation of streaming-write folio
  netfs: Fix folio->private handling in netfs_perform_write()
  netfs: Fix netfs_read_folio() to wait on writeback
  netfs, afs: Fix write skipping in dir/link writepages
  afs: Fix the locking used by afs_get_link()

Paulo Alcantara (1):
  netfs: fix error handling in netfs_extract_user_iter()

Viacheslav Dubeyko (1):
  netfs: fix VM_BUG_ON_FOLIO() issue in netfs_write_begin() call

 fs/9p/vfs_inode.c            |   2 +-
 fs/9p/vfs_inode_dotl.c       |   4 +-
 fs/afs/Makefile              |   1 +
 fs/afs/dir.c                 |  79 ++++----
 fs/afs/fsclient.c            |   4 +-
 fs/afs/inode.c               | 104 +---------
 fs/afs/internal.h            |  34 +++-
 fs/afs/symlink.c             | 270 ++++++++++++++++++++++++++
 fs/afs/validation.c          |   8 +-
 fs/afs/write.c               |   2 +-
 fs/afs/yfsclient.c           |   4 +-
 fs/netfs/buffered_read.c     |  71 +++----
 fs/netfs/buffered_write.c    | 161 ++++++++++------
 fs/netfs/direct_read.c       |  42 ++--
 fs/netfs/direct_write.c      |   4 +-
 fs/netfs/internal.h          |   3 +
 fs/netfs/iterator.c          |  36 ++--
 fs/netfs/misc.c              |  22 ++-
 fs/netfs/read_collect.c      |  19 +-
 fs/netfs/read_retry.c        |  17 +-
 fs/netfs/read_single.c       |  23 +--
 fs/netfs/write_collect.c     |   9 +-
 fs/netfs/write_issue.c       |  18 +-
 fs/netfs/write_retry.c       |   6 +-
 fs/smb/client/cifsfs.c       |  28 +--
 fs/smb/client/cifssmb.c      |   2 +-
 fs/smb/client/file.c         |   9 +-
 fs/smb/client/inode.c        |   9 +-
 fs/smb/client/readdir.c      |   3 +-
 fs/smb/client/smb2ops.c      |  16 +-
 fs/smb/client/smb2pdu.c      |   2 +-
 include/linux/list.h         |  37 ++++
 include/linux/netfs.h        | 364 ++++++++++++++++++++++++++++++++++-
 include/trace/events/netfs.h |   8 +
 34 files changed, 1056 insertions(+), 365 deletions(-)
 create mode 100644 fs/afs/symlink.c


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2026-04-28 13:20 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-28 13:17 [PATCH v5 00/24] netfs: Miscellaneous fixes David Howells
2026-04-28 13:17 ` [PATCH v5 01/24] netfs: Fix cancellation of a DIO and single read subrequests David Howells
2026-04-28 13:17 ` [PATCH v5 02/24] netfs: Fix missing locking around retry adding new subreqs David Howells
2026-04-28 13:17 ` [PATCH v5 03/24] netfs: Fix missing barriers when accessing stream->subrequests locklessly David Howells
2026-04-28 13:17 ` [PATCH v5 04/24] netfs: Fix netfs_read_to_pagecache() to pause on subreq failure David Howells
2026-04-28 13:17 ` [PATCH v5 05/24] netfs: Fix potential for tearing in ->remote_i_size and ->zero_point David Howells
2026-04-28 13:17 ` [PATCH v5 06/24] netfs: Fix zeropoint update where i_size > remote_i_size David Howells
2026-04-28 13:17 ` [PATCH v5 07/24] netfs: fix VM_BUG_ON_FOLIO() issue in netfs_write_begin() call David Howells
2026-04-28 13:17 ` [PATCH v5 08/24] netfs: fix error handling in netfs_extract_user_iter() David Howells
2026-04-28 13:17 ` [PATCH v5 09/24] netfs: Fix overrun check " David Howells
2026-04-28 13:17 ` [PATCH v5 10/24] netfs: Fix potential uninitialised var " David Howells
2026-04-28 13:17 ` [PATCH v5 11/24] netfs: Fix netfs_invalidate_folio() to clear dirty bit if all changes gone David Howells
2026-04-28 13:17 ` [PATCH v5 12/24] netfs: Defer the emission of trace_netfs_folio() David Howells
2026-04-28 13:17 ` [PATCH v5 13/24] netfs: Fix streaming write being overwritten David Howells
2026-04-28 13:17 ` [PATCH v5 14/24] netfs: Fix potential deadlock in write-through mode David Howells
2026-04-28 13:17 ` [PATCH v5 15/24] netfs: Fix read-gaps to remove netfs_folio from filled folio David Howells
2026-04-28 13:17 ` [PATCH v5 16/24] netfs: Fix write streaming disablement if fd open O_RDWR David Howells
2026-04-28 13:17 ` [PATCH v5 17/24] netfs: Fix early put of sink folio in netfs_read_gaps() David Howells
2026-04-28 13:17 ` [PATCH v5 18/24] netfs: Fix leak of request in netfs_write_begin() error handling David Howells
2026-04-28 13:17 ` [PATCH v5 19/24] netfs: Fix potential UAF in netfs_unlock_abandoned_read_pages() David Howells
2026-04-28 13:17 ` [PATCH v5 20/24] netfs: Fix partial invalidation of streaming-write folio David Howells
2026-04-28 13:17 ` [PATCH v5 21/24] netfs: Fix folio->private handling in netfs_perform_write() David Howells
2026-04-28 13:17 ` [PATCH v5 22/24] netfs: Fix netfs_read_folio() to wait on writeback David Howells
2026-04-28 13:17 ` [PATCH v5 23/24] netfs, afs: Fix write skipping in dir/link writepages David Howells
2026-04-28 13:17 ` [PATCH v5 24/24] afs: Fix the locking used by afs_get_link() David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox