From owner-svn-src-head@FreeBSD.ORG Thu Dec 25 02:17:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 77D7EE68; Thu, 25 Dec 2014 02:17:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63AA536F1; Thu, 25 Dec 2014 02:17:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBP2HI9I096941; Thu, 25 Dec 2014 02:17:18 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBP2HI0f096940; Thu, 25 Dec 2014 02:17:18 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201412250217.sBP2HI0f096940@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Thu, 25 Dec 2014 02:17:18 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Dec 2014 02:17:18 -0000 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);