]> git.proxmox.com Git - mirror_zfs.git/commit
Improve zpool status output, list all affected datasets
authorGeorge Amanakis <gamanakis@gmail.com>
Tue, 26 Apr 2022 00:25:42 +0000 (02:25 +0200)
committerGitHub <noreply@github.com>
Tue, 26 Apr 2022 00:25:42 +0000 (17:25 -0700)
commit0409d3327371cef8a8c5886cb7530ded6f5f1091
treeb73cbc15898fe8df7126557ced5522e165200cd3
parent95146fd7baba8f70baea35b9b6bfac277431b940
Improve zpool status output, list all affected datasets

Currently, determining which datasets are affected by corruption is
a manual process.

The primary difficulty in reporting the list of affected snapshots is
that since the error was initially found, the snapshot where the error
originally occurred in, may have been deleted. To solve this issue, we
add the ID of the head dataset of the original snapshot which the error
was detected in, to the stored error report. Then any time a filesystem
is deleted, the errors associated with it are deleted as well. Any time
a clone promote occurs, we modify reports associated with the original
head to refer to the new head. The stored error reports are identified
by this head ID, the birth time of the block which the error occurred
in, as well as some information about the error itself are also stored.

Once this information is stored, we can find the set of datasets
affected by an error by walking back the list of snapshots in the given
head until we find one with the appropriate birth txg, and then traverse
through the snapshots of the clone family, terminating a branch if the
block was replaced in a given snapshot. Then we report this information
back to libzfs, and to the zpool status command, where it is displayed
as follows:

 pool: test
 state: ONLINE
status: One or more devices has experienced an error resulting in data
        corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
        entire pool from backup.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
  scan: scrub repaired 0B in 00:00:00 with 800 errors on Fri Dec  3
08:27:57 2021
config:

        NAME        STATE     READ WRITE CKSUM
        test        ONLINE       0     0     0
          sdb       ONLINE       0     0 1.58K

errors: Permanent errors have been detected in the following files:

        test@1:/test.0.0
        /test/test.0.0
        /test/1clone/test.0.0

A new feature flag is introduced to mark the presence of this change, as
well as promotion and backwards compatibility logic. This is an updated
version of #9175. Rebase required fixing the tests, updating the ABI of
libzfs, updating the man pages, fixing bugs, fixing the error returns,
and updating the old on-disk error logs to the new format when
activating the feature.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Co-authored-by: TulsiJain <tulsi.jain@delphix.com>
Signed-off-by: George Amanakis <gamanakis@gmail.com>
Closes #9175
Closes #12812
21 files changed:
include/sys/dsl_dataset.h
include/sys/spa.h
include/sys/zio.h
include/zfeature_common.h
lib/libnvpair/libnvpair.abi
lib/libuutil/libuutil.abi
lib/libzfs/libzfs.abi
lib/libzfsbootenv/libzfsbootenv.abi
man/man4/zfs.4
man/man7/zpool-features.7
module/zcommon/zfeature_common.c
module/zfs/dsl_dataset.c
module/zfs/dsl_destroy.c
module/zfs/spa_errlog.c
module/zfs/zfeature.c
module/zfs/zfs_ioctl.c
tests/runfiles/common.run
tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg
tests/zfs-tests/tests/functional/cli_root/zpool_status/Makefile.am
tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_003_pos.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_004_pos.ksh [new file with mode: 0755]