Bug fix: Complete the page writeback immediately if zfs_putpage was called with WB_SYNC_NONE #12776
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.
Motivation and Context
Fixes: #12662
Description
When the kernel occasionally performs a background page writeback,
WB_SYNC_NONE
is specified as sync mode. Currently it appears that the page stays in the page writeback state until the transaction group is synced which then triggerszfs_putpage_commit_cb
and unsets the page writeback bit. This blocks other threads that are doing an msync with MS_SYNC for several seconds until the txg is synced due to the txg timeout.Given that WB_SYNC_NONE is specified, if I got it correctly, the correct behaviour should be that there is no need for the kernel to wait for the write to be done to stable storage, so in the fix I've completed the callback immediately if WB_SYNC_NONE is specified.
I'm new to the zfs/kernel source and just wanted some feedback to validate if the problem description/solution makes sense before making more progress on it (I still need to test the fix)
How Has This Been Tested?
PR still in draft to validate if the approach is correct.
Types of changes
Checklist:
Signed-off-by
.