Clarify and restrict dmu_tx_assign() errors #17463
Merged
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
ztest
could ASSERT inztest_tx_assign()
when an IO error was encountered. This occurs because it only checks forERESTART
andENOSPC
. It does not consider either the over quota or IO error cases. Let's fix that.Rather than attempting to enumerate each possible error code all
tx->tx_err
's are converted to EIO. I couldn't find any cases where the additional detail was actually useful to the caller, so I opted to simply the interface. The intent is to make it easier for callers to reason about each possible error and handle it appropriately.Description
There are three possible cases where
dmu_tx_assign()
may encounter a fatal error. When there is a true lack of free space (ENOSPC), when there is a lack of quota space (EDQUOT), or when data required to perform the transaction cannot be read from disk (EIO). See thedmu_tx_check_ioerr()
function for additional details on the motivation for checking for I/O errors early.Prior to this
change dmu_tx_assign()
would return the contents oftx->tx_err
which covered a wide range of possible error codes (EIO, ECKSUM, ESRCH, etc). In practice, none of the callers could do anything useful with this level of detail and simply returned the error.Therefore, this change converts all
tx->tx_err
errors to EIO, adds ASSERTs todmu_tx_assign()
to cover the only possible errors, and clarifies the function comment to include EIO as a possible fatal error.How Has This Been Tested?
Locally compiled. It still need a full run through the test suite by the CI.
Types of changes
Checklist:
Signed-off-by
.