SVNews r332536

NOTE: This service is experimental and subject to change! Use at your own risk!

2018-04-16 03:45:39 - r332536 by mav (Alexander Motin)

Complete list of files affected by revision r332536:

(Note: At the moment, these links point to ViewVC on They are probably slow. Do not overuse.)

   Contents     MODIFY   /stable/11  
  History   Contents   Diff   MODIFY   /stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c  
  History   Contents   Diff   MODIFY   /stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h  
  History   Contents   Diff   MODIFY   /stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c  
  History   Contents   Diff   MODIFY   /stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c  
  History   Contents   Diff   MODIFY   /stable/11/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c  
  History   Contents   Diff   MODIFY   /stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h  
  History   Contents   Diff   MODIFY   /stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  
  History   Contents   Diff   MODIFY   /stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c  
  History   Contents   Diff   MODIFY   /stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c  
  History   Contents   Diff   MODIFY   /stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h  
  History   Contents   Diff   MODIFY   /stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h  
  History   Contents   Diff   MODIFY   /stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h  
  History   Contents   Diff   MODIFY   /stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h  
  History   Contents   Diff   MODIFY   /stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  
  History   Contents   Diff   MODIFY   /stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c  
  History   Contents   Diff   MODIFY   /stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c  
  History   Contents   Diff   MODIFY   /stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c  
  History   Contents   Diff   MODIFY   /stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c  
  History   Contents   Diff   MODIFY   /stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h  

Commit message:

MFC r329798: MFV r329793, r329795:
9075 Improve ZFS pool import/load process and corrupted pool recovery


Some work has been done lately to improve the debugability of the ZFS pool
load (and import) process. This includes: Refactor spa_load_impl into several
functions SPA load/import should tell us why it
failed zdb should be able to print zfs_dbgmsg's

To iterate on top of that, there's a few changes that were made to make the
import process more resilient and crash free. One of the first tasks during the
pool load process is to parse a config provided from userland that describes
what devices the pool is composed of. A vdev tree is generated from that config,
and then all the vdevs are opened.

The Meta Object Set (MOS) of the pool is accessed, and several metadata objects
that are necessary to load the pool are read. The exact configuration of the
pool is also stored inside the MOS. Since the configuration provided from
userland is external and might not accurately describe the vdev tree
of the pool at the txg that is being loaded, it cannot be relied upon to safely
operate the pool. For that reason, the configuration in the MOS is read early
on. In the past, the two configurations were compared together and if there was
a mismatch then the load process was aborted and an error was returned.

The latter was a good way to ensure a pool does not get corrupted, however it
made the pool load process needlessly fragile in cases where the vdev
configuration changed or the userland configuration was outdated. Since the MOS
is stored in 3 copies, the configuration provided by userland doesn't have to be
perfect in order to read its contents. Hence, a new approach has been adopted:
The pool is first opened with the untrusted userland configuration just so that
the real configuration can be read from the MOS. The trusted MOS configuration
is then used to generate a new vdev tree and the pool is re-opened.

When the pool is opened with an untrusted configuration, writes are disabled
to avoid accidentally damaging it. During reads, some sanity checks are
performed on block pointers to see if each DVA points to a known vdev;
when the configuration is untrusted, instead of panicking the system if those
checks fail we simply avoid issuing reads to the invalid DVAs.

This new two-step pool load process now allows rewinding pools accross
vdev tree changes such as device replacement, addition, etc. Loading a pool
from an external config file in a clustering environment also becomes much
safer now since the pool will import even if the config is outdated and didn't,
for instance, register a recent device addition.

With this code in place, it became relatively easy to implement a
long-sought-after feature: the ability to import a pool with missing top level
(i.e. non-redundant) devices. Note that since this almost guarantees some loss
Of data, this feature is for now restricted to a read-only import.

Reviewed by: George Wilson <>
Reviewed by: Matthew Ahrens <>
Reviewed by: Andrew Stormont <>
Approved by: Hans Rosenfeld <>
Author: Pavel Zakharov <>


Powered by Python FreeBSD support by secnetix GmbH & Co. KG

Page generated in 16 ms, 20 files printed. Current time is 2018-04-23 15:02:14. All times are in UTC/GMT.