-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
zinject: count matches and injections for each handler #16938
Conversation
tests/zfs-tests/tests/functional/cli_root/zinject/zinject_counts.ksh
Outdated
Show resolved
Hide resolved
tests/zfs-tests/tests/functional/cli_root/zinject/zinject_counts.ksh
Outdated
Show resolved
Hide resolved
This is a really nice quality of life feature. I will definitely be using it! |
For real! I've had a hacky version of this for about a year and I while I still don't love zinject for a bunch of reasons, I can't imagine how I ever used it without this! |
tests/zfs-tests/tests/functional/cli_root/zinject/zinject_counts.ksh
Outdated
Show resolved
Hide resolved
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.
@robn looks good. Would you mind squashing these commits? Should be ready to merge after that.
When building tests with zinject, it can be quite difficult to work out if you're producing the right kind of IO to match the rules you've set up. So, here we extend injection records to count the number of times a handler matched the operation, and how often an error was actually injected (ie after frequency and other exclusions are applied). Then, display those counts in the `zinject` output. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]>
[Sponsors: Klara, Inc., Wasabi Technology, Inc.]
Motivation and Context
When building tests with
zinject
, it can be quite difficult to work out if you're producing the right kind of IO to match the rules you've set up. Imagine if instead, when you runzinject
and get the list of handlers, it also showed you how many times it had matched one, and how many times it actually injected one (can be different when using frequencies).Imagine no longer!
Description
Extends
zinject_record_t
with two new fields,zi_match_count
andzi_inject_count
.For each injection type, increments one or both of these as appropriate. For record types that don't have a notion of "frequency", they are necessarily incremented together.
Then, for the injection records that have appropriate display, show the counts. Device and object injections show both, while delay shows only the single count. The others don't have reasonable display methods and/or counts don't really make sense for them, so I haven't bothered showing them.
This is technically an ABI break:
zinject_record_t
is now 16 bytes longer than it was. Old userspace on new kernel won't care, but new userspace on old kernel may read garbage or segfault on those count fields. I don't really care; I consider the injection facility to be a swiss-army chainsaw tied deeply into the matching module version, and a crashing userspace program is the least of your concerns. If I'm wrong, say so, and I'll see what I can do to make the ABI a bit more stable.REVIEW BONUS!
@amotin suggested that with a small adjustment, we could usefully count delay handler matches separately from injections. We can, and it's very nice, so that's added as a second commit.
How Has This Been Tested?
Test included.
ZTS runs on a handful of zinject-using tests pass cleanly.
Types of changes
Checklist:
Signed-off-by
.