Skip to content

Commit

Permalink
Different approach to reporting openzfs#2094 erratum.
Browse files Browse the repository at this point in the history
Add a new pool status, ZPOOL_STATUS_SCAN_ERRATA which indicates
the openzfs#2094 erratum has been detected.  This allows for a "zpool
import" or a "zpool status" to report the problem.
  • Loading branch information
dweeezil committed Feb 12, 2014
1 parent 7e35fd5 commit f115c41
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
31 changes: 18 additions & 13 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1715,6 +1715,11 @@ show_import(nvlist_t *config)
"resilvered.\n"));
break;

case ZPOOL_STATUS_SCAN_ERRATA:
(void) printf(gettext(" status: pool compatibility issue detected.\n\t"
"See: https://github.com/zfsonlinux/zfs/issues/2094.\n"));
break;

default:
/*
* No other status can be seen when importing pools.
Expand All @@ -1736,6 +1741,11 @@ show_import(nvlist_t *config)
(void) printf(gettext(" action: The pool can be "
"imported using its name or numeric "
"identifier and\n\tthe '-f' flag.\n"));
} else if (reason == ZPOOL_STATUS_SCAN_ERRATA) {
(void) printf(gettext(" action: The pool can be "
"imported using its name or numeric "
"identifier, though\n\tthe compatibility issue "
"should be corrected by running 'zpool scrub'\n"));
} else {
(void) printf(gettext(" action: The pool can be "
"imported using its name or numeric "
Expand Down Expand Up @@ -3903,19 +3913,6 @@ print_scan_status(pool_scan_stat_t *ps)
return;
}

/*
* Scan required due to known errata.
*/
if ((ps->pss_pass_errata & DSE_ZOL_2094) &&
(ps->pss_state == DSS_FINISHED || ps->pss_state == DSS_CANCELED)) {
(void) printf(gettext("pool compatibility issue detected.\n"));
(void) printf(gettext(
" see: https://github.com/zfsonlinux/zfs/issues/2094\n"));
(void) printf(gettext(
"action: To correct the issue run 'zpool scrub'.\n"));
return;
}

start = ps->pss_start_time;
end = ps->pss_end_time;
zfs_nicenum(ps->pss_processed, processed_buf, sizeof (processed_buf));
Expand Down Expand Up @@ -4362,6 +4359,14 @@ status_callback(zpool_handle_t *zhp, void *data)
"'zpool clear'.\n"));
break;

case ZPOOL_STATUS_SCAN_ERRATA:
(void) printf(gettext("status: pool compatibility issue detected.\n"));
(void) printf(gettext(
"\tsee: https://github.com/zfsonlinux/zfs/issues/2094\n"));
(void) printf(gettext(
"action: To correct the issue run 'zpool scrub'.\n"));
break;

default:
/*
* The remaining errors can't actually be generated, yet.
Expand Down
1 change: 1 addition & 0 deletions include/libzfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ typedef enum {
ZPOOL_STATUS_RESILVERING, /* device being resilvered */
ZPOOL_STATUS_OFFLINE_DEV, /* device online */
ZPOOL_STATUS_REMOVED_DEV, /* removed device */
ZPOOL_STATUS_SCAN_ERRATA, /* incompatible scan detected */

/*
* Finally, the following indicates a healthy pool.
Expand Down
7 changes: 7 additions & 0 deletions lib/libzfs/libzfs_status.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,13 @@ check_status(nvlist_t *config, boolean_t isimport)
}
}

/*
* Scan required due to known errata.
*/
if (ps && (ps->pss_pass_errata & DSE_ZOL_2094) &&
(ps->pss_state == DSS_FINISHED || ps->pss_state == DSS_CANCELED))
return (ZPOOL_STATUS_SCAN_ERRATA);

return (ZPOOL_STATUS_OK);
}

Expand Down

0 comments on commit f115c41

Please sign in to comment.