-
Notifications
You must be signed in to change notification settings - Fork 1.8k
zfs_cmd
: reorganise zfs_cmd_t
to match original size
#17367
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
base: master
Are you sure you want to change the base?
Conversation
bee4337
to
8b87b57
Compare
On FreeBSD:
|
8b87b57
to
ce35a6c
Compare
Ugh, I forgot about Alright, I've pushed another version that uses those defines directly in the size check. I like this even less because we won't detect if those change, but they're even harder to pin for just this struct if they do change, so idk. I mostly want a signal that we've screwed up, not a comprehensive protection, so I hope this is enough. |
2aa3fbe extended zinject_record_t, and in doing so inadvertently extended zfs_cmd_t, which broke compatibility with userspace tools without the change. This fixes that by using some of the unused space in zfs_cmd_t for the extra fields. We also add an assert to trigger a compile error if the size ever changes. Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris <[email protected]>
ce35a6c
to
85b2f8e
Compare
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.
As an additional compatibility check why don't we use of a copy of struct zfs_cmd
from the 2.2.0 release in the tests/zfs-tests/cmd/libzfs_input_check.c
test. This way we'll always be testing the basic libzfs compatibility.
@behlendorf I like the idea, but I'm not sure it helps without some rework. The test only tests the nvlist ioctls. In f414ff5 I make a very small Unless you meant something different that has gone straight over my head? |
Motivation and Context
2aa3fbe extended
zinject_record_t
, and in doing so inadvertently extendedzfs_cmd_t
, which broke compatibility with userspace tools without the change.Description
This fixes that by using some of the unused space in
zfs_cmd_t
for the extra fields. We also add an assert to trigger a compile error if the size ever changes.With this commit:
Compare with 2.2.7:
Importantly, each individual field has the same alignment.
There's other ways to do this, eg by having a
zinject_record_ext_t
as a union in a different position, but it's just different ways to arrange the deckchairs.I don't really love this, but it seems like an ok stopgap. The other options are to revert 2aa3fbe on master too, or push forward to convert
ZFS_IOC_INJECT
to nvlists or something equally hefty. Good things to do, and we will, when we're done with all these other things!How Has This Been Tested?
Just basic local testing. I've not done interop testing, but pahole suggests everything lines up nice.
Types of changes
Checklist:
Signed-off-by
.