-
Notifications
You must be signed in to change notification settings - Fork 1.9k
libzfs_core
: add ZFS_IOC_TRACE
envvar to enable ioctl tracing
#17344
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
Closed
+96
−17
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
amotin
reviewed
May 19, 2025
amotin
approved these changes
May 20, 2025
Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris <robn@despairlabs.com>
Name the OS-specific call lzc_ioctl_fd_os(), and make lzc_ioctl_fd() wrap it, so we can do more in the wrapper. Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris <robn@despairlabs.com>
When set, dumps all ZFS ioctl calls and returns and their nvlists to STDERR, to make debugging and understanding a lot easier. Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris <robn@despairlabs.com>
amotin
approved these changes
May 21, 2025
behlendorf
approved these changes
May 21, 2025
behlendorf
pushed a commit
that referenced
this pull request
May 21, 2025
Name the OS-specific call lzc_ioctl_fd_os(), and make lzc_ioctl_fd() wrap it, so we can do more in the wrapper. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #17344
behlendorf
pushed a commit
that referenced
this pull request
May 21, 2025
When set, dumps all ZFS ioctl calls and returns and their nvlists to STDERR, to make debugging and understanding a lot easier. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #17344
robn
added a commit
to robn/zfs
that referenced
this pull request
May 23, 2025
Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes openzfs#17344 (cherry picked from commit f454cc1)
robn
added a commit
to robn/zfs
that referenced
this pull request
May 23, 2025
Name the OS-specific call lzc_ioctl_fd_os(), and make lzc_ioctl_fd() wrap it, so we can do more in the wrapper. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes openzfs#17344 (cherry picked from commit c4c3917)
robn
added a commit
to robn/zfs
that referenced
this pull request
May 23, 2025
When set, dumps all ZFS ioctl calls and returns and their nvlists to STDERR, to make debugging and understanding a lot easier. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes openzfs#17344 (cherry picked from commit a387b75)
robn
added a commit
to robn/zfs
that referenced
this pull request
May 24, 2025
Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes openzfs#17344 (cherry picked from commit f454cc1)
robn
added a commit
to robn/zfs
that referenced
this pull request
May 24, 2025
Name the OS-specific call lzc_ioctl_fd_os(), and make lzc_ioctl_fd() wrap it, so we can do more in the wrapper. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes openzfs#17344 (cherry picked from commit c4c3917)
robn
added a commit
to robn/zfs
that referenced
this pull request
May 24, 2025
When set, dumps all ZFS ioctl calls and returns and their nvlists to STDERR, to make debugging and understanding a lot easier. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes openzfs#17344 (cherry picked from commit a387b75)
tonyhutter
pushed a commit
that referenced
this pull request
May 28, 2025
Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #17344 (cherry picked from commit f454cc1)
tonyhutter
pushed a commit
that referenced
this pull request
May 28, 2025
Name the OS-specific call lzc_ioctl_fd_os(), and make lzc_ioctl_fd() wrap it, so we can do more in the wrapper. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #17344 (cherry picked from commit c4c3917)
tonyhutter
pushed a commit
that referenced
this pull request
May 28, 2025
When set, dumps all ZFS ioctl calls and returns and their nvlists to STDERR, to make debugging and understanding a lot easier. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #17344 (cherry picked from commit a387b75)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Understanding how the command line tools and the kernel module coordinate is tricky to understand sometimes, and while system tracing tools can show you the raw
ioctl()
calls, they usually have no idea about nvlists.So, this adds a simple tracing facility that will dump
ioctl()
calls and returns.Description
First two commits are some light reorganisation to make
lzc_ioctl_fd()
a single chokepoint where all calls come through, and which then call any platform-specific code.Top commit is the meat: if the
ZFS_IOC_TRACE
environment variable is set, thenlzc_ioctl_fd()
will put info about the call and return onto STDERR, with the source and dest nvlists if applicable.Note that I'm only dumping nvlist contents, not trying to deal with all of
zfs_cmd_t
. Not that that wouldn't be useful, it's just not what I needed right now. Easily added later.Some examples.
zfs get
receives results in nvlists:zpool wait
has a request nvlist:Some have no nvlists, but you still get an idea of what's going on:
How Has This Been Tested?
By hand, as above, on both Linux and FreeBSD. I'll let the buildbots make sure nothing is broken, but I don't expect anything weird because if the envvar isn't set, it should just be the fast path.
Types of changes
Checklist:
Signed-off-by
.