Repository navigation
vfs: return an SMB read-ahead connection with its pool's window - #19943
Merged
Merged
Conversation
Davey-Hughes
force-pushed
the
smb-pool-swap
branch
from
October 30, 2026 00:52
423495f to
e4786ff
Compare
A read-ahead stream turns off the client read-ahead on its prefetcher's pooled connection while the prefetcher runs. It did so before opening the file and left it off when the open or the prefetcher failed, so the slot went back to its pool with no window. On close it set the window from the current settings, but a pool keeps the settings it was built with and is used again when the settings return to them, so after a read-ahead change a connection could go back to its pool with the wrong window. The window now goes off only after a successful open and is restored from the pool's key whenever it was turned off.
A new phase has a thread switch the settings between two connection keys while the workers open, read and list, so slots are taken from and given back to two pools as a settings edit would. The two-shares phase covers a second share; this covers the key changing under them.
Davey-Hughes
force-pushed
the
smb-pool-swap
branch
from
October 30, 2026 01:14
e4786ff to
9d75e49
Compare
A stream with a prefetcher open while read-ahead is turned off now checks, once it closes, that every idle pooled connection still has its pool's window. This fails without the read-ahead fix before it. smb_pool_windows_ok() makes the check, with a getter for the window the built-in client holds. The switching phase is driven by the workers, each moving the key on after a round, instead of a thread spinning on smb_init_cfg(). It switches across five keys, more than there are pools, half of them with read-ahead off, so idle pools are evicted beside busy ones, and it checks the windows once the workers are done.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR first fixed the SMB pool being freed under its users on a settings change. #19939's pool table already fixes that on master, so it is now down to the one fix master still lacks, plus a test for the settings-change case.
Changes
vfs_threads_testgains a phase in which a thread switches the settings between two connection keys while four workers open, read and list. Slots are then taken from and given back to two pools, as a settings edit would cause. The existing two-shares phase covers a second share; this covers the key changing.Testing
vfs_threads_test,vfs_test,smb_idle_testandcloud_sync_testpass under ASan.vfs_threads_testpasses under TSan with 0 warnings, for the built-in client and libsmb2.--disable-threadsbuilds pass.