aboutsummaryrefslogtreecommitdiff
path: root/module/zfs/vdev_label.c
diff options
context:
space:
mode:
authorPavel Zakharov <pavel.zakharov@delphix.com>2016-03-10 15:16:02 +0000
committerBrian Behlendorf <behlendorf1@llnl.gov>2018-05-09 04:30:10 +0000
commit4a0ee12af8967a859c3607530aaef466e21cebc3 (patch)
treeae5079139035cfa72fdc0e4673775954ab9f8206 /module/zfs/vdev_label.c
parentca0845d59efe5881d14e0bb90603a5152eb07227 (diff)
downloadsrc-4a0ee12af8967a859c3607530aaef466e21cebc3.tar.gz
src-4a0ee12af8967a859c3607530aaef466e21cebc3.zip
OpenZFS 8961 - SPA load/import should tell us why it failed
Problem ======= 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()`. Solution ======== 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 `vdev_disk_open()`. Authored by: Pavel Zakharov <pavel.zakharov@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Andrew Stormont <andyjstormont@gmail.com> Approved by: Dan McDonald <danmcd@joyent.com> Ported-by: Tim Chase <tim@chase2k.com> Signed-off-by: Tim Chase <tim@chase2k.com> OpenZFS-issue: https://illumos.org/issues/8961 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/418079e0 Closes #7459
Diffstat (limited to 'module/zfs/vdev_label.c')
-rw-r--r--module/zfs/vdev_label.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/module/zfs/vdev_label.c b/module/zfs/vdev_label.c
index b91e332de39f..ad334fe8c2c6 100644
--- a/module/zfs/vdev_label.c
+++ b/module/zfs/vdev_label.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
*/
/*
@@ -1204,8 +1204,15 @@ vdev_uberblock_load(vdev_t *rvd, uberblock_t *ub, nvlist_t **config)
* Search all labels on this vdev to find the configuration that
* matches the txg for our uberblock.
*/
- if (cb.ubl_vd != NULL)
+ if (cb.ubl_vd != NULL) {
+ vdev_dbgmsg(cb.ubl_vd, "best uberblock found for spa %s. "
+ "txg %llu", spa->spa_name, (u_longlong_t)ub->ub_txg);
+
*config = vdev_label_read_config(cb.ubl_vd, ub->ub_txg);
+ if (*config == NULL) {
+ vdev_dbgmsg(cb.ubl_vd, "failed to read label config");
+ }
+ }
spa_config_exit(spa, SCL_ALL, FTAG);
}