Skip to content
Browse files

OpenZFS 8961 - SPA load/import should tell us why it failed


When we fail to open or import a storage pool, we typically don't
get any additional diagnostic information, just "no pool found" or
"can not import".

While there may be no additional user-consumable information, we should
at least make this situation easier to debug/diagnose for developers
and support.  For example, we could start by using `zfs_dbgmsg()`
to log each thing that we try when importing, and which things
failed. E.g. "tried uberblock of txg X from label Y of device Z". Also,
we could log each of the stages that we go through in `spa_load_impl()`.


Following the cleanup to `spa_load_impl()`, debug messages have been
added to every point of failure in that function. Additionally,
debug messages have been added to strategic places, such as

Authored by: Pavel Zakharov <>
Reviewed by: George Wilson <>
Reviewed by: Matthew Ahrens <>
Reviewed by: Andrew Stormont <>
Approved by: Dan McDonald <>
Ported-by: Tim Chase <>
Signed-off-by: Tim Chase <>

OpenZFS-commit: openzfs/openzfs@418079e
Closes #7459
  • Loading branch information...
pzakha authored and behlendorf committed Mar 10, 2016
1 parent ca0845d commit 4a0ee12af8967a859c3607530aaef466e21cebc3
Showing with 281 additions and 75 deletions.
  1. +2 −0 include/sys/spa.h
  2. +2 −1 include/sys/vdev.h
  3. +175 −63 module/zfs/spa.c
  4. +28 −0 module/zfs/spa_misc.c
  5. +62 −8 module/zfs/vdev.c
  6. +3 −1 module/zfs/vdev_disk.c
  7. +9 −2 module/zfs/vdev_label.c
@@ -985,6 +985,8 @@ extern uint64_t spa_deadman_synctime(spa_t *spa);
extern uint64_t spa_deadman_ziotime(spa_t *spa);

/* Miscellaneous support routines */
extern void spa_load_failed(spa_t *spa, const char *fmt, ...);
extern void spa_load_note(spa_t *spa, const char *fmt, ...);
extern void spa_activate_mos_feature(spa_t *spa, const char *feature,
dmu_tx_t *tx);
extern void spa_deactivate_mos_feature(spa_t *spa, const char *feature);
@@ -21,7 +21,7 @@

* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
* Copyright (c) 2011, 2016 by Delphix. All rights reserved.

#ifndef _SYS_VDEV_H
@@ -47,6 +47,7 @@ typedef enum vdev_dtl_type {

extern int zfs_nocacheflush;

extern void vdev_dbgmsg(vdev_t *vd, const char *fmt, ...);
extern int vdev_open(vdev_t *);
extern void vdev_open_children(vdev_t *);
extern int vdev_validate(vdev_t *, boolean_t);

0 comments on commit 4a0ee12

Please sign in to comment.
You can’t perform that action at this time.