Skip to content
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

zdb -ddddddd fails on newly created zpool #7986

Closed
rudis opened this issue Oct 4, 2018 · 12 comments
Closed

zdb -ddddddd fails on newly created zpool #7986

rudis opened this issue Oct 4, 2018 · 12 comments
Labels
Status: Stale No recent activity for issue Type: Documentation Indicates a requested change to the documentation

Comments

@rudis
Copy link

rudis commented Oct 4, 2018

System information

Type Version/Name
Distribution Name Debian
Distribution Version Stretch
Linux Kernel 4.9.110
Architecture amd64
ZFS Version 0.7.11-1~bpo9-1
SPL Version 0.7.11-1~bpo9-1

Describe the problem you're observing

zdb -ddddddd fails on newly created pool

Describe how to reproduce the problem

# zpool create test raidz2 /dev/lvm/zfs{1,2,3,4}
# cd /test
# echo hi > x
# ls -i x
2 x
# zdb -dddddddddddd test 2
Dataset mos [META], ID 0, cr_txg 4, 349K, 43 objects, rootbp DVA[0]=<0:12f000:3000> DVA[1]=<0:260012c000:3000> DVA[2]=<0:4c000d2000:3000> [L0 DMU objset] fletcher4 uncompressed LE contiguous unique triple size=800L/800P birth=9L/9P fill=43 cksum=366b3f29c:647471174cf:5cef7c72f0d45:39743ba7fcabe1d

    Object  lvl   iblk   dblk  dsize  dnsize  lsize   %full  type
zdb: dmu_bonus_hold(2) failed, errno 2
#

I'm also confused by the fact that fletcher4 is displayed, even if I manually select sha512 as hash before creating the file.

@loli10K
Copy link
Contributor

loli10K commented Oct 4, 2018

zdb -d $POOLNAME <num> will lookup object <num> in the pool MOS, you want zdb -d $POOLNAME/ <num> to reference objects in the "$POOLNAME" dataset:

root@linux:~# truncate -s 128m /var/tmp/{1,2,3,4}
root@linux:~# zpool create -f test -O checksum=sha512 raidz2 /var/tmp/{1,2,3,4}
root@linux:~# cd /test
root@linux:/test# echo hi > x
root@linux:/test# ls -i x
2 x
root@linux:/test# zdb -dddddddddddd test 2
Dataset mos [META], ID 0, cr_txg 4, 76.2K, 43 objects, rootbp DVA[0]=<0:27c00:600> DVA[1]=<0:6027600:600> DVA[2]=<0:c013e00:600> [L0 DMU objset] fletcher4 lz4 LE contiguous unique triple size=800L/200P birth=7L/7P fill=43 cksum=c5bbe111c:41f4276f87a:b9f3a8cdad3f:17070d262477b3

    Object  lvl   iblk   dblk  dsize  dnsize  lsize   %full  type
zdb: dmu_bonus_hold(2) failed, errno 2
root@linux:/test# zdb -dddddddddddd test/ 2
Dataset test [ZPL], ID 51, cr_txg 1, 33.6K, 7 objects, rootbp DVA[0]=<0:26400:600> DVA[1]=<0:6025e00:600> [L0 DMU objset] sha512 lz4 LE contiguous unique double size=800L/200P birth=7L/7P fill=7 cksum=e91efb4b1f2d8466:eb00002e2c0e9fc7:64981c64563b217f:edb0e231dfcdadbf

    Object  lvl   iblk   dblk  dsize  dnsize  lsize   %full  type
         2    1   128K    512    512     512    512  100.00  ZFS plain file (K=inherit) (Z=inherit)
                                               168   bonus  System attributes
	dnode flags: USED_BYTES USERUSED_ACCOUNTED USEROBJUSED_ACCOUNTED 
	dnode maxblkid: 0
	path	/x
	uid     0
	gid     0
	atime	Thu Oct  4 12:36:12 2018
	mtime	Thu Oct  4 12:36:12 2018
	ctime	Thu Oct  4 12:36:12 2018
	crtime	Thu Oct  4 12:36:12 2018
	gen	7
	mode	100644
	size	3
	parent	34
	links	1
	pflags	40800000004
Indirect blocks:
               0 L0 0:20a00:600 200L/200P F=1 B=7/7

		segment [0000000000000000, 0000000000000200) size   512

root@linux:/test# 

@rudis
Copy link
Author

rudis commented Oct 4, 2018

Thank you! pool/ works fine.

Would it be possible to mention this in the man page and improve the error message so the difference between pool and pool/ is clear?

@loli10K loli10K added the Type: Documentation Indicates a requested change to the documentation label Oct 4, 2018
@DeHackEd
Copy link
Contributor

DeHackEd commented Oct 4, 2018

It is.

@rudis
Copy link
Author

rudis commented Oct 4, 2018

Ah, sorry. Missed that.

Regarding the error when using the pool instead of the dataset. Is it expected that it returns (to me) arbitrary looking data before dying with this error? I know zdb is just a debug tool, but it would be nice to catch this user error.

@rudis
Copy link
Author

rudis commented Oct 4, 2018

Oh, and maybe an example with just the root dataset would be nice. I know it's documented, but I quickly skimmed over the examples and Example 3 looked like I was looking for, except I missed the trailing /.

@rincebrain
Copy link
Contributor

rincebrain commented Oct 4, 2018

Hm.

When I tried this while discussing it last night, I used zdb -vvvvvvv testpool 2 and got the same error.

(Also on ZoL 0.7.11 from Debian stretch backports.)

Many hours later:

# zdb -vvvvvvv 'testpool/' 2
Dataset testpool [ZPL], ID 51, cr_txg 1, 37.4K, 9 objects, rootbp DVA[0]=<0:17a600:600> DVA[1]=<0:60179400:600> [L0 DMU objset] fletcher4 lz4 LE contiguous unique double size=800L/200P birth=97L/97P fill=9 cksum=c7b732a36:4cd8c0903c0:f4be20942ca7:2190a8426be727

    Object  lvl   iblk   dblk  dsize  dnsize  lsize   %full  type
zdb: dmu_bonus_hold(2) failed, errno 2

ZFS_DBGMSG(zdb):
#

(I too had never known that particular bit of esoterica involving the root dataset, but I also almost never store things there, so...)

@Lady-Galadriel
Copy link

Lady-Galadriel commented Oct 4, 2018

Perhaps Example 3 should be for the "root" dataset with a trailing / (slash);

  Example 3 Display basic information about object 2 in rpool top level dataset

        # zdb -d rpool/ 2

And all the other examples renumbered.

Further, it would be nicer if the error message returned made more sense for the actual issue. For example;

zdb: object not found, errno X

(Add me to learning something new about ZFS today...)
Edit: Corrected spelling and English syntax.

@loli10K
Copy link
Contributor

loli10K commented Oct 5, 2018

When I tried this while discussing it last night, I used zdb -vvvvvvv testpool 2 and got the same error.
(Also on ZoL 0.7.11 from Debian stretch backports.)

@rincebrain if you are able to reproduce this on newly created pools could you please create a sample on a small file-vdev pool (like in my example) and upload it here?

@rincebrain
Copy link
Contributor

Sure, here you are.

(Regardless of which file, both contain 4 sparse files of 2GB each that have about 11 MB of nonzero data between them. zdb -vvvvvvv testpool/ 2 reproducibly does the above for me even after export+import. The directory on the pool isn't important, I was just trying to see if I could make it stop reproducing.)

7986_pool_ex.zip

And if that doesn't work for some reason, you can find a .tgz here, since Github claims it won't let me upload a tgz.

@loli10K
Copy link
Contributor

loli10K commented Oct 5, 2018

@rincebrain unless i am missing something obvious your reproducer (zip-compressed pool files) have no file with inum=2 so that error is expected:

root@linux:~# ls -li /testpool/
total 3
128 drwxr-xr-x 2 root root 2 Oct  4 09:52 foo
256 -rw-r--r-- 1 root root 3 Oct  4 09:56 monkeymadness
  3 -rw-r--r-- 1 root root 3 Oct  4 09:50 test
root@linux:~# zpool get guid testpool
NAME      PROPERTY  VALUE  SOURCE
testpool  guid      11682838301589054648  -
root@linux:~# zdb -dddddd testpool/ 3
Dataset testpool [ZPL], ID 51, cr_txg 1, 37.4K, 9 objects, rootbp DVA[0]=<0:803c600:600> DVA[1]=<0:6803c600:600> [L0 DMU objset] fletcher4 lz4 LE contiguous unique double size=800L/200P birth=15704L/15704P fill=9 cksum=c329c21a1:4b4478a7c9d:f09638a4fbb1:21277810630dc5

    Object  lvl   iblk   dblk  dsize  dnsize  lsize   %full  type
         3    1   128K    512    512     512    512  100.00  ZFS plain file (K=inherit) (Z=inherit)
                                               168   bonus  System attributes
	dnode flags: USED_BYTES USERUSED_ACCOUNTED USEROBJUSED_ACCOUNTED 
	dnode maxblkid: 0
	path	/test
	uid     0
	gid     0
	atime	Thu Oct  4 09:50:20 2018
	mtime	Thu Oct  4 09:50:20 2018
	ctime	Thu Oct  4 09:50:20 2018
	crtime	Thu Oct  4 09:50:20 2018
	gen	28
	mode	100644
	size	3
	parent	34
	links	1
	pflags	40800000004
Indirect blocks:
               0 L0 0:12c600:600 200L/200P F=1 B=28/28

		segment [0000000000000000, 0000000000000200) size   512

root@linux:~# 

@rincebrain
Copy link
Contributor

Nice, I am going to assume I tried making a new file and deleted the old one.

Feel free to close it and subject me to ribbing for trying to look at bugs on too little sleep; I'll probably go file a separate enhancement request complaining about the error being opaque.

@stale
Copy link

stale bot commented Aug 25, 2020

This issue has been automatically marked as "stale" because it has not had any activity for a while. It will be closed in 90 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale No recent activity for issue label Aug 25, 2020
@stale stale bot closed this as completed Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale No recent activity for issue Type: Documentation Indicates a requested change to the documentation
Projects
None yet
Development

No branches or pull requests

5 participants