netfs: Miscellaneous fixes
Status from this message: Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 posting 2/215 patches 7 repliesApplied
- v2 posting 2/214 patches 2 repliesSuperseded
- v6 Latest24 patches 3 repliesApplied
Earlier versions · 6
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v5 | 24 patches | 0 replies | Superseded | |
| v4 posting 2/2 | 22 patches | 0 replies | Superseded | |
| v4 posting 1/2 | 11 of 22 patches | 0 replies | Superseded | |
| v3 posting 1/2 | 19 patches | 0 replies | Superseded | |
| v2 posting 1/2 | 7 patches | 1 reply | Applied | |
| v1 | 4 patches | 2 replies | Superseded |
Patches in v6 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/24 | netfs: Fix cancellation of a DIO and single read subrequestsfs/ fs/ fs/ +2 more | +50 | 0 replies | |
| 2/24 | netfs: Fix missing locking around retry adding new subreqsfs/ fs/ | +10 | 0 replies | |
| 3/24 | netfs: Fix missing barriers when accessing stream->subrequests locklesslyfs/ fs/ fs/ +3 more | +50 | 0 replies | |
| 4/24 | netfs: Fix netfs_read_to_pagecache() to pause on subreq failurefs/ | +5 | 0 replies | |
| 5/24 | netfs: Fix potential for tearing in ->remote_i_size and ->zero_pointfs/ fs/ fs/ +17 more | +450 | 0 replies | |
| 6/24 | netfs: Fix zeropoint update where i_size > remote_i_sizefs/ | +2 | 0 replies | |
| 7/24 | netfs: fix VM_BUG_ON_FOLIO() issue in netfs_write_begin() callfs/ | +9 | 0 replies | |
| 8/24 | netfs: Fix potential uninitialised var in netfs_extract_user_iter()fs/ | +1 | 2 replies | |
| 9/24 | netfs: fix error handling in netfs_extract_user_iter()fs/ | +10 | 0 replies | |
| 10/24 | netfs: Fix overrun check in netfs_extract_user_iter()fs/ | +17 | 0 replies | |
| 11/24 | netfs: Fix netfs_invalidate_folio() to clear dirty bit if all changes gonefs/ include/ | +9 | 0 replies | |
| 12/24 | netfs: Defer the emission of trace_netfs_folio()fs/ | +10 | 0 replies | |
| 13/24 | netfs: Fix streaming write being overwrittenfs/ include/ | +37 | 0 replies | |
| 14/24 | netfs: Fix potential deadlock in write-through modefs/ | +25 | 0 replies | |
| 15/24 | netfs: Fix read-gaps to remove netfs_folio from filled foliofs/ | +8 | 0 replies | |
| 16/24 | netfs: Fix write streaming disablement if fd open O_RDWRfs/ | +7 | 0 replies | |
| 17/24 | netfs: Fix early put of sink folio in netfs_read_gaps()fs/ | +3 | 0 replies | |
| 18/24 | netfs: Fix leak of request in netfs_write_begin() error handlingfs/ | +1 | 0 replies | |
| 19/24 | netfs: Fix potential UAF in netfs_unlock_abandoned_read_pages()fs/ fs/ fs/ +1 more | +5 | 0 replies | |
| 20/24 | netfs: Fix partial invalidation of streaming-write foliofs/ | +1 | 0 replies | |
| 21/24 | netfs: Fix folio->private handling in netfs_perform_write()fs/ include/ | +82 | 0 replies | |
| 22/24 | netfs: Fix netfs_read_folio() to wait on writebackfs/ | +2 | 0 replies | |
| 23/24 | netfs, afs: Fix write skipping in dir/link writepagesfs/ fs/ | +16 | 0 replies | |
| 24/24 | afs: Fix the locking used by afs_get_link()fs/ fs/ fs/ +5 more | +357 | 0 replies |
Reviews trailers per patch
2 of 24 patches have a Reviewed-by or Acked-by.
| Patch | Paulo Alcantara (Red Hat) |
|---|---|
| 1/24 | |
| 2/24 | |
| 3/24 | |
| 4/24 | |
| 5/24 | |
| 6/24 | |
| 7/24 | R-b |
| 8/24 | |
| 9/24 | |
| 10/24 | |
| 11/24 | |
| 12/24 | |
| 13/24 | |
| 14/24 | |
| 15/24 | |
| 16/24 | |
| 17/24 | R-b |
| 18/24 | |
| 19/24 | |
| 20/24 | |
| 21/24 | |
| 22/24 | |
| 23/24 | |
| 24/24 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v6 00/24] netfs: Miscellaneous fixes
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][5] are addressed:
(1) Fix subrequest cancellation cleanup in DIO read and single-read.
(2) Fix missing locking around retry adding new subrequests.
(3) 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.
(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 a potentially uninitialised error value in netfs_extract_user_iter().
(9) Fix error handling in netfs_extract_user_iter().
(10) Fix overrun checking 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
[5] https://sashiko.dev/#/patchset/20260428131756.922303-1-dhowells%40redhat.com
Changes
=======
ver #6)
- Fix more Sashiko issues[5].
- Handle another missed cancellation in netfs_read_to_pagecache().
- Made sure that all updates of i_size within netfslib, 9p, afs and cifs are done with i_lock held to prevent i_size_seqcount getting corrupted if remote_i_size or zero_point are updated.
- In netfs_perform_write(), make it so that in write-through mode the modified folios aren't put into writeback mode until each is completed to prevent races with mmap.
- In netfs_perform_write(), annotate the conditions under which group differences cause a folio to be flushed and warn if the filesystem mixes no-group (ie. NULL) with groups.
- In afs_evict_symlink(), avoid a lockdep splat due to not holding any locks when doing an RCU op.
- In afs_init_new_symlink(), don't access an __rcu pointer directly.
- In afs_do_read_symlink(), use the size returned by netfs_read_single() rather than i_size as the size of the symlink content.
- In afs_symlink_writepages(), avoid a double free.
- In afs_validate(), make sure we don't call afs_invalidate_symlink() on a directory.
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: 5d6919055dec134de3c40167a490f33c74c12581
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 potential uninitialised var in netfs_extract_user_iter()
netfs: Fix overrun check 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/v9fs_vfs.h | 13 -- fs/9p/vfs_inode.c | 6 +- fs/9p/vfs_inode_dotl.c | 12 +- fs/afs/Makefile | 1 + fs/afs/dir.c | 79 +++++----- fs/afs/file.c | 24 ++- fs/afs/fsclient.c | 4 +- fs/afs/inode.c | 127 +++------------ fs/afs/internal.h | 45 +++--- fs/afs/symlink.c | 278 +++++++++++++++++++++++++++++++++ fs/afs/validation.c | 14 +- fs/afs/write.c | 2 +- fs/afs/yfsclient.c | 4 +- fs/netfs/buffered_read.c | 73 +++++---- fs/netfs/buffered_write.c | 174 +++++++++++++-------- fs/netfs/direct_read.c | 42 ++--- fs/netfs/direct_write.c | 6 +- fs/netfs/internal.h | 3 + fs/netfs/iterator.c | 41 +++-- fs/netfs/misc.c | 41 +++-- fs/netfs/read_collect.c | 19 ++- fs/netfs/read_retry.c | 17 +- fs/netfs/read_single.c | 23 ++- fs/netfs/write_collect.c | 15 +- fs/netfs/write_issue.c | 49 ++++-- fs/netfs/write_retry.c | 6 +- fs/smb/client/cifsfs.c | 38 +++-- fs/smb/client/cifssmb.c | 3 +- fs/smb/client/file.c | 13 +- fs/smb/client/inode.c | 14 +- fs/smb/client/readdir.c | 3 +- fs/smb/client/smb2ops.c | 42 +++-- fs/smb/client/smb2pdu.c | 3 +- include/linux/list.h | 37 +++++ include/linux/netfs.h | 295 +++++++++++++++++++++++++++++++++-- include/trace/events/netfs.h | 8 + 36 files changed, 1142 insertions(+), 432 deletions(-) create mode 100644 fs/afs/symlink.c