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: Fix zdb '-O|-r' options with -e/exported zpool #15532

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

akashb-22
Copy link
Contributor

Motivation and Context

Signed-off-by: Akash B akash-b@hpe.com
For a given zpool used by lustre (dataset) which consists of many files and directories, where we were not able to use zdb -O option to get the objectid for the path which was reported by zpool status -v and was failing with below errors. The zpools are generally created with cachefile=none option, so zdb -e +option is generally used to debug.

-snip-of-zpool-status-
errors: Permanent errors have been detected in the following files:

        pool-mds65/mdt65:/oi.9/0x200000009:0x0:0x0
-snip-

# zdb -e pool-mds65/mdt65 -O oi.9/0x200000009:0x0:0x0
failed to hold dataset 'pool-mds65/mdt65': No such file or directory

# zdb -e -p . pool-oss0/ost0 -O file1
failed to hold dataset 'pool-oss0/ost0': No such file or directory

# zdb -e -p . pool-oss0/ost0 -O file1 -vvv
failed to hold dataset 'pool-oss0/ost0': No such file or directory

# zdb -e pool-oss0/ost0 -r file1 /tmp/filecopy1 -p.
failed to hold dataset 'pool-oss0/ost0': No such file or directory
zdb: internal error: No such file or directory

Description

zdb with '-e' or exported zpool doesn't work along with '-O' and '-r' options as we process them before '-e' has been processed.

Below errors are seen:

~> zdb -e pool-mds65/mdt65 -O oi.9/0x200000009:0x0:0x0 
failed to hold dataset 'pool-mds65/mdt65': No such file or directory

~> zdb -e pool-oss0/ost0 -r file1 /tmp/filecopy1 -p. 
failed to hold dataset 'pool-oss0/ost0': No such file or directory
zdb: internal error: No such file or directory

We need to make sure to process '-O|-r' options after the '-e' option has been processed, which imports the pool to the namespace if it's not in the cachefile.

Issue reproduced with:

# truncate -s 1G file1 file2 file3 file4 file5 file6 file7 file8 file9 file10 file11 file12 file13 file14 file15
# pwd
/root/test/files
# zpool create -f -o cachefile=none -o failmode=panic -O canmount=off pool-oss0 draid2:11d:2s /root/test/files/file1 /root/test/files/file2 /root/test/files/file3 /root/test/files/file4 /root/test/files/file5 /root/test/files/file6 /root/test/files/file7 /root/test/files/file8 /root/test/files/file9 /root/test/files/file10 /root/test/files/file11 /root/test/files/file12 /root/test/files/file13 /root/test/files/file14 /root/test/files/file15
# zfs create -o mountpoint=/mnt/ost0 pool-oss0/ost0
# zfs set recordsize=4M pool-oss0/ost0
# touch /mnt/ost0/file1
# zpool sync -f pool-oss0
# zpool export -f -a
# 
# zdb -e -p . pool-oss0/ost0 -O file1 -vvv
failed to hold dataset 'pool-oss0/ost0': No such file or directory
# zdb -e -p. pool-oss0/ost0 -r file1 /tmp/filecopy1
failed to hold dataset 'pool-oss0/ost0': No such file or directory
zdb: internal error: No such file or directory
#
# zdb -dddddd pool-oss0/ost0 -e -p. 2 | grep path
        path    /file1

with the fix applied:

# zdb -e -p . pool-oss0/ost0 -O file1 -vvv

    Object  lvl   iblk   dblk  dsize  dnsize  lsize   %full  type
         2    1   128K    512      0     512    512    0.00  ZFS plain file (K=inherit) (Z=inherit=lz4)
                                               176   bonus  System attributes
        dnode flags: USERUSED_ACCOUNTED USEROBJUSED_ACCOUNTED
        dnode maxblkid: 0
        uid     0
        gid     0
        atime   Thu Nov 16 06:23:50 2023
        mtime   Thu Nov 16 06:23:50 2023
        ctime   Thu Nov 16 06:23:50 2023
        crtime  Thu Nov 16 06:23:50 2023
        gen     16
        mode    100644
        size    0
        parent  34
        links   1
        pflags  840800000004
Indirect blocks:

# zdb -e -p. pool-oss0/ost0 -r file1 /tmp/filecopy1
Copying object 2 to file /tmp/filecopy1
Object 2 is 0 bytes

How Has This Been Tested?

Tested locally in KVM and server along with lustre.
ZTS.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

zdb with '-e' or exported zpool doesn't work along with
'-O' and '-r' options as we process them before '-e' has
been processed.

Below errors are seen:

~> zdb -e pool-mds65/mdt65 -O oi.9/0x200000009:0x0:0x0
failed to hold dataset 'pool-mds65/mdt65': No such file or directory

~> zdb -e pool-oss0/ost0 -r file1 /tmp/filecopy1 -p.
failed to hold dataset 'pool-oss0/ost0': No such file or directory
zdb: internal error: No such file or directory

We need to make sure to process '-O|-r' options after the
'-e' option has been processed, which imports the pool to
the namespace if it's not in the cachefile.

Signed-off-by: Akash B <akash-b@hpe.com>
@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Nov 16, 2023
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Nov 27, 2023
@behlendorf behlendorf merged commit c1a47de into openzfs:master Nov 27, 2023
22 of 26 checks passed
@akashb-22 akashb-22 deleted the zdb_obj_lookup branch November 28, 2023 04:45
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Nov 28, 2023
zdb with '-e' or exported zpool doesn't work along with
'-O' and '-r' options as we process them before '-e' has
been processed.

Below errors are seen:

~> zdb -e pool-mds65/mdt65 -O oi.9/0x200000009:0x0:0x0
failed to hold dataset 'pool-mds65/mdt65': No such file or directory

~> zdb -e pool-oss0/ost0 -r file1 /tmp/filecopy1 -p.
failed to hold dataset 'pool-oss0/ost0': No such file or directory
zdb: internal error: No such file or directory

We need to make sure to process '-O|-r' options after the
'-e' option has been processed, which imports the pool to
the namespace if it's not in the cachefile.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Akash B <akash-b@hpe.com>
Closes openzfs#15532
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Nov 28, 2023
zdb with '-e' or exported zpool doesn't work along with
'-O' and '-r' options as we process them before '-e' has
been processed.

Below errors are seen:

~> zdb -e pool-mds65/mdt65 -O oi.9/0x200000009:0x0:0x0
failed to hold dataset 'pool-mds65/mdt65': No such file or directory

~> zdb -e pool-oss0/ost0 -r file1 /tmp/filecopy1 -p.
failed to hold dataset 'pool-oss0/ost0': No such file or directory
zdb: internal error: No such file or directory

We need to make sure to process '-O|-r' options after the
'-e' option has been processed, which imports the pool to
the namespace if it's not in the cachefile.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Akash B <akash-b@hpe.com>
Closes openzfs#15532
behlendorf pushed a commit that referenced this pull request Nov 28, 2023
zdb with '-e' or exported zpool doesn't work along with
'-O' and '-r' options as we process them before '-e' has
been processed.

Below errors are seen:

~> zdb -e pool-mds65/mdt65 -O oi.9/0x200000009:0x0:0x0
failed to hold dataset 'pool-mds65/mdt65': No such file or directory

~> zdb -e pool-oss0/ost0 -r file1 /tmp/filecopy1 -p.
failed to hold dataset 'pool-oss0/ost0': No such file or directory
zdb: internal error: No such file or directory

We need to make sure to process '-O|-r' options after the
'-e' option has been processed, which imports the pool to
the namespace if it's not in the cachefile.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Akash B <akash-b@hpe.com>
Closes #15532
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Dec 12, 2023
zdb with '-e' or exported zpool doesn't work along with
'-O' and '-r' options as we process them before '-e' has
been processed.

Below errors are seen:

~> zdb -e pool-mds65/mdt65 -O oi.9/0x200000009:0x0:0x0
failed to hold dataset 'pool-mds65/mdt65': No such file or directory

~> zdb -e pool-oss0/ost0 -r file1 /tmp/filecopy1 -p.
failed to hold dataset 'pool-oss0/ost0': No such file or directory
zdb: internal error: No such file or directory

We need to make sure to process '-O|-r' options after the
'-e' option has been processed, which imports the pool to
the namespace if it's not in the cachefile.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Akash B <akash-b@hpe.com>
Closes openzfs#15532
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants