From owner-svn-src-all@freebsd.org  Mon Aug 12 11:42:16 2019
Return-Path: <owner-svn-src-all@freebsd.org>
Delivered-To: svn-src-all@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAD10B0517;
 Mon, 12 Aug 2019 11:42:16 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 466YqD5QQqz4FTf;
 Mon, 12 Aug 2019 11:42:16 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4C2C26136;
 Mon, 12 Aug 2019 11:42:16 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7CBgGGC004623;
 Mon, 12 Aug 2019 11:42:16 GMT (envelope-from avg@FreeBSD.org)
Received: (from avg@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7CBgGAd004621;
 Mon, 12 Aug 2019 11:42:16 GMT (envelope-from avg@FreeBSD.org)
Message-Id: <201908121142.x7CBgGAd004621@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
 using -f
From: Andriy Gapon <avg@FreeBSD.org>
Date: Mon, 12 Aug 2019 11:42:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350897 - in head: cddl/contrib/opensolaris/cmd/zpool
 sys/cddl/contrib/opensolaris/common/zfs
X-SVN-Group: head
X-SVN-Commit-Author: avg
X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zpool
 sys/cddl/contrib/opensolaris/common/zfs
X-SVN-Commit-Revision: 350897
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 12 Aug 2019 11:42:16 -0000

Author: avg
Date: Mon Aug 12 11:42:16 2019
New Revision: 350897
URL: https://svnweb.freebsd.org/changeset/base/350897

Log:
  MFV r350896: 6585 sha512, skein, and edonr have an unenforced dependency on extensible dataset
  
  illumos/illumos-gate@892586e8a147c02d7f4053cc405229a13e796928
  https://github.com/illumos/illumos-gate/commit/892586e8a147c02d7f4053cc405229a13e796928
  
  https://www.illumos.org/issues/6585
    In any pool without the extensible dataset feature flag already enabled,
    creating a dataset with dedup set to use one of the new checksums would result
    in the following panic as soon as any data was added:
    panic[cpu0]/thread=ffffff0006761c40: feature_get_refcount(spa, feature,
    &refcount) != 48 (0x30 != 0x30), file: ../../common/fs/zfs/zfeature.c line 390
  
    ffffff0006761830 fffffffffba8fbdd ()
    ffffff0006761890 zfs:feature_do_action+11a ()
    ffffff00067618c0 zfs:spa_feature_incr+1e ()
    ffffff0006761920 zfs:dmu_object_zapify+b7 ()
    ffffff00067619b0 zfs:dsl_dataset_activate_feature+97 ()
    ffffff0006761a20 zfs:dsl_dataset_sync+ba ()
    ffffff0006761ab0 zfs:dsl_pool_sync+153 ()
    ffffff0006761b70 zfs:spa_sync+26e ()
    ffffff0006761c20 zfs:txg_sync_thread+227 ()
    ffffff0006761c30 unix:thread_start+8 ()
    Inspection showed that feature->fi_feature was 7, which is the value of
    SPA_FEATURE_EXTENSIBLE_DATASET in the spa_feature enum.
    Testing shows that the panic can be prevented by explicitly setting extensible
    dataset as a dependency for the sha512, edonr, and skein feature flags.
    Alternatively, the new checksums code could possibly be changed to obviate the
    need for the dependency.
  
  Reviewed by: Matthew Ahrens <mahrens@delphix.com>
  Reviewed by: Richard Laager <rlaager@wiktel.com>
  Approved by: Robert Mustacchi <rm@joyent.com>
  Author: ilovezfs <ilovezfs@icloud.com>
  
  Note that FreeBSD does not support ednor yet.
  
  MFC after:	2 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
  head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7	Mon Aug 12 11:27:17 2019	(r350896)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7	Mon Aug 12 11:42:16 2019	(r350897)
@@ -531,7 +531,7 @@ boot loader.
 .Bl -column "READ\-ONLY COMPATIBLE" "org.illumos:sha512"
 .It GUID Ta org.illumos:sha512
 .It READ\-ONLY COMPATIBLE Ta no
-.It DEPENDENCIES Ta none
+.It DEPENDENCIES Ta extensible_dataset
 .El
 .Pp
 The
@@ -570,7 +570,7 @@ are destroyed.
 .Bl -column "READ\-ONLY COMPATIBLE" "org.illumos:skein"
 .It GUID Ta org.illumos:skein
 .It READ\-ONLY COMPATIBLE Ta no
-.It DEPENDENCIES Ta none
+.It DEPENDENCIES Ta extensible_dataset
 .El
 .Pp
 The

Modified: head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c	Mon Aug 12 11:27:17 2019	(r350896)
+++ head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c	Mon Aug 12 11:42:16 2019	(r350897)
@@ -255,20 +255,33 @@ zpool_feature_init(void)
 	    ZFEATURE_FLAG_PER_DATASET, large_dnode_deps);
 	}
 
+	static const spa_feature_t sha512_deps[] = {
+		SPA_FEATURE_EXTENSIBLE_DATASET,
+		SPA_FEATURE_NONE
+	};
 	zfeature_register(SPA_FEATURE_SHA512,
 	    "org.illumos:sha512", "sha512",
 	    "SHA-512/256 hash algorithm.",
-	    ZFEATURE_FLAG_PER_DATASET, NULL);
+	    ZFEATURE_FLAG_PER_DATASET, sha512_deps);
+
+	static const spa_feature_t skein_deps[] = {
+		SPA_FEATURE_EXTENSIBLE_DATASET,
+		SPA_FEATURE_NONE
+	};
 	zfeature_register(SPA_FEATURE_SKEIN,
 	    "org.illumos:skein", "skein",
 	    "Skein hash algorithm.",
-	    ZFEATURE_FLAG_PER_DATASET, NULL);
+	    ZFEATURE_FLAG_PER_DATASET, skein_deps);
 
 #ifdef illumos
+	static const spa_feature_t edonr_deps[] = {
+		SPA_FEATURE_EXTENSIBLE_DATASET,
+		SPA_FEATURE_NONE
+	};
 	zfeature_register(SPA_FEATURE_EDONR,
 	    "org.illumos:edonr", "edonr",
 	    "Edon-R hash algorithm.",
-	    ZFEATURE_FLAG_PER_DATASET, NULL);
+	    ZFEATURE_FLAG_PER_DATASET, edonr_deps);
 #endif
 
 	zfeature_register(SPA_FEATURE_DEVICE_REMOVAL,