Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Dec 2014 02:17:18 +0000 (UTC)
From:      Steven Hartland <smh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r276194 - head/cddl/contrib/opensolaris/cmd/zpool
Message-ID:  <201412250217.sBP2HI0f096940@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: smh
Date: Thu Dec 25 02:17:17 2014
New Revision: 276194
URL: https://svnweb.freebsd.org/changeset/base/276194

Log:
  Prevent zpool upgrade failing due to unavailable pools
  
  Prior to this fix "zpool upgrade" and "zpool upgrade -a" would fail due to
  an assert when operating on unavailable pools.
  
  We now print a warning to stderr but allow the processing of other pools
  to procesed.
  
  MFC after:	1 month

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Thu Dec 25 01:55:17 2014	(r276193)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Thu Dec 25 02:17:17 2014	(r276194)
@@ -4629,6 +4629,13 @@ upgrade_cb(zpool_handle_t *zhp, void *ar
 	boolean_t printnl = B_FALSE;
 	int ret;
 
+	if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) {
+		(void) fprintf(stderr, gettext("cannot upgrade '%s': pool is "
+		    "currently unavailable\n\n"), zpool_get_name(zhp));
+		/* Allow iteration to continue. */
+		return (0);
+	}
+
 	config = zpool_get_config(zhp, NULL);
 	verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION,
 	    &version) == 0);
@@ -4729,6 +4736,14 @@ upgrade_list_disabled_cb(zpool_handle_t 
 	nvlist_t *config;
 	uint64_t version;
 
+	if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) {
+		(void) fprintf(stderr, gettext("cannot check supported "
+		    "features on '%s': pool is currently unavailable\n\n"),
+		    zpool_get_name(zhp));
+		/* Allow iteration to continue. */
+		return (0);
+	}
+
 	config = zpool_get_config(zhp, NULL);
 	verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION,
 	    &version) == 0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412250217.sBP2HI0f096940>