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
Fix problems with zdb -d <pool>/<objset ID> #12944
Conversation
So, experimentally, I think -N does something that's not quite specified in the manual, at least on my system. I would have expected, given dataset paths "workspace/1M", "workspace/0x512" and "workspace/1M/0x512" exist, zdb -d to work as expected (now) on all three, but zdb -N to fail on 1 and 3 and work IFF a dataset with id 0x512 exists, but experimentally (-d does work as expected):
I don't think the behavior it has now is fundamentally wrong in any way, just that it's not what I took from the man page update and my own assumptions - I would have expected "force only objsetid interpretation", not "try objsetid interpretation if it looks like a number, otherwise just act like you passed -d". |
I opted to close the loophole with -N noted by @rincebrain. |
zdb -d <pool>/<objset ID> does not work when other command line arguments are included i.e. zdb -U <cachefile> -d <pool>/<objset ID> This change fixes the command line parsing to handle this situation. Also fix issue where zdb -r <dataset> <file> does not handle the root <dataset> of the pool. Introduce -N option to force <objset ID> to be interpreted as a numeric objsetID. Fixes openzfs#12845 Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
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.
$ sudo cmd/zdb/zdb -N workspace/1M
Supply a numeric objset ID with -N
$ sudo cmd/zdb/zdb -N workspace/0x512
failed to hold objset 1298: No such file or directory
zdb: can't open 'workspace/0x512': No such file or directory
$ sudo cmd/zdb/zdb -N workspace/1M/0x512
Supply a numeric objset ID with -N
$
Hello @behlendorf @tonynguien can this PR get added to the list of things to include in next 2.1.x? thanks |
@PaulZ-98 that sounds like a good idea. Would you mind opening a new PR against the zfs-2.1.6-staging branch with this change. |
zdb -d <pool>/<objset ID> does not work when other command line arguments are included i.e. zdb -U <cachefile> -d <pool>/<objset ID> This change fixes the command line parsing to handle this situation. Also fix issue where zdb -r <dataset> <file> does not handle the root <dataset> of the pool. Introduce -N option to force <objset ID> to be interpreted as a numeric objsetID. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Rich Ercolani <rincebrain@gmail.com> Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com> Signed-off-by: Paul Zuchowski <pzuchowski@datto.com> Closes openzfs#12845 Closes openzfs#12944
zdb -d <pool>/<objset ID> does not work when other command line arguments are included i.e. zdb -U <cachefile> -d <pool>/<objset ID> This change fixes the command line parsing to handle this situation. Also fix issue where zdb -r <dataset> <file> does not handle the root <dataset> of the pool. Introduce -N option to force <objset ID> to be interpreted as a numeric objsetID. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Rich Ercolani <rincebrain@gmail.com> Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com> Signed-off-by: Paul Zuchowski <pzuchowski@datto.com> Closes #12845 Closes #12944
zdb -d <pool>/<objset ID> does not work when other command line arguments are included i.e. zdb -U <cachefile> -d <pool>/<objset ID> This change fixes the command line parsing to handle this situation. Also fix issue where zdb -r <dataset> <file> does not handle the root <dataset> of the pool. Introduce -N option to force <objset ID> to be interpreted as a numeric objsetID. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Rich Ercolani <rincebrain@gmail.com> Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com> Signed-off-by: Paul Zuchowski <pzuchowski@datto.com> Closes openzfs#12845 Closes openzfs#12944
zdb -d <pool>/<objset ID> does not work when other command line arguments are included i.e. zdb -U <cachefile> -d <pool>/<objset ID> This change fixes the command line parsing to handle this situation. Also fix issue where zdb -r <dataset> <file> does not handle the root <dataset> of the pool. Introduce -N option to force <objset ID> to be interpreted as a numeric objsetID. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Rich Ercolani <rincebrain@gmail.com> Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com> Signed-off-by: Paul Zuchowski <pzuchowski@datto.com> Closes openzfs#12845 Closes openzfs#12944
zdb -d <pool>/<objset ID>
does not work whenother command line arguments are included i.e.
zdb -U <cachefile> -d <pool>/<objset ID>
This change fixes the command line parsing
to handle this situation. Also fix issue
where
zdb -r <dataset> <file>
does not handlethe root
<dataset>
of the pool. Introduce -Noption to force
<objset ID>
to be interpretedas a numeric objsetID.
Fixes #12845
Signed-off-by: Paul Zuchowski pzuchowski@datto.com
Motivation and Context
zdb -d
<pool>/<objset ID>
has several issues.<pool>/<objset ID>
is not argv[2]<objset ID>
is a dataset beginning with number(s)<pool>/100
where 100 is the dataset name#12845
Description
Removed the code assuming argv[2]. Added helper function to see if is numeric. Added code to assume / is a named dataset, and if that fails, silently try as an objsetID. Added -N to force to be an objset ID, not a named dataset. Augmented the zfstest for zdb -d /. Updated man page for -N.
How Has This Been Tested?
zdb section of zfstest, also
If you have tank/100 and tank/fs with an objset ID of 100:
zdb -d tank/100 displays tank/100
zdb -N tank/100 displays tank/fs
-N is the same as -d, or you can do -Nd (or -NNN converted to -ddd internally..)
If you have tank/fs1 with an objset ID of 101:
zdb -d tank/101 will try to find "tank/101" (i.e. 101 is the dataset name), and fail silently and try tank/101 as objsetID 101 and find tank/fs1
zdb -N tank/101 will display tank/fs1
If you have tank/118 with objsetID 201:
zdb -N tank/118 will fail
zdb -d tank/118 will succeed
Types of changes
Checklist:
Signed-off-by
.