-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix l2arc_apply_transforms ztest crash #15248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Paul Dagnelie <[email protected]>
There's no specific tests around the EA code, but all the l2arc compressed_arc disabled tests were what was exploding then, which was likely just this problem, but that fix happened to work because it wasn't simulating a mixed ashift environment. So I think you could probably make a trivial modification of those tests to test this breaking with the previous patch reverted in both mixed ashift and not cases, if you'd like, watch that explode, then watch one but not the other explode with current git, and both not explode with this. |
Signed-off-by: Paul Dagnelie <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. Note that I got a bit carried away with feedback as I was distracted by some elements of the function that are not technically part of this fix.
In openzfs#13375 we modified the allocation size of the buffer that we use to apply l2arc transforms to be the size of the arc hdr we're using, rather than the allocation size that will be in place on the disk, because sometimes the hdr size is larger. Unfortunately, sometimes the allocation size is larger, which means that we overflow the buffer in that case. This change modifies the allocation to be the max of the two values Reviewed-by: Mark Maybee <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Paul Dagnelie <[email protected]> Closes openzfs#15177 Closes openzfs#15248
In openzfs#13375 we modified the allocation size of the buffer that we use to apply l2arc transforms to be the size of the arc hdr we're using, rather than the allocation size that will be in place on the disk, because sometimes the hdr size is larger. Unfortunately, sometimes the allocation size is larger, which means that we overflow the buffer in that case. This change modifies the allocation to be the max of the two values Reviewed-by: Mark Maybee <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Paul Dagnelie <[email protected]> Closes openzfs#15177 Closes openzfs#15248
In #13375 we modified the allocation size of the buffer that we use to apply l2arc transforms to be the size of the arc hdr we're using, rather than the allocation size that will be in place on the disk, because sometimes the hdr size is larger. Unfortunately, sometimes the allocation size is larger, which means that we overflow the buffer in that case. This change modifies the allocation to be the max of the two values Reviewed-by: Mark Maybee <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Paul Dagnelie <[email protected]> Closes #15177 Closes #15248
In openzfs#13375 we modified the allocation size of the buffer that we use to apply l2arc transforms to be the size of the arc hdr we're using, rather than the allocation size that will be in place on the disk, because sometimes the hdr size is larger. Unfortunately, sometimes the allocation size is larger, which means that we overflow the buffer in that case. This change modifies the allocation to be the max of the two values Reviewed-by: Mark Maybee <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Paul Dagnelie <[email protected]> Closes openzfs#15177 Closes openzfs#15248
Motivation and Context
We have a crash ocurring pretty regularly in zloop that indicates corruption in the buffer allocated by
l2arc_apply_transforms
. This issue is documented in #15177.Description
In #13375 we modified the allocation size of the buffer that we use to apply l2arc transforms to be the size of the arc hdr we're using, rather than the allocation size that will be in place on the disk, because sometimes the hdr size is larger. Unfortunately, sometimes the allocation size is larger, which means that we overflow the buffer in that case. This change modifies the allocation to be the max of the two values.
How Has This Been Tested?
Two hours of zloop runs with asan, and the issue did not recur. Previously it reliably occurred within 30 minutes. I'm not sure of the easiest way to test to make sure that the original issue is still fixed; @rincebrain is there a test in the test suite that covers it? If not I can try to do some manual testing of the early abort logic.
Types of changes
Checklist:
Signed-off-by
.