Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Aug 2019 07:17:49 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r351383 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201908220717.x7M7Hnep025663@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Thu Aug 22 07:17:49 2019
New Revision: 351383
URL: https://svnweb.freebsd.org/changeset/base/351383

Log:
  MFC r350894: a stop gap fix for a race between dnode_hold and dnode_sync_free
  
  The race was introduced in r337669, the large dnode feature import from
  ZoL.  The problem was debugged by ZoL developers and then,
  independently, on FreeBSD.
  
  The fix is an early proposal by Brian Behlendorf:
  https://github.com/behlendorf/zfs/commit/50f32ed74e42aa28522e9681fb8ae55239fa33a7
  This fix never went into ZoL.  A larger change that was committed later
  included a different solution because of the re-worked code.
  
  Ideally, we want to revert this fix and re-synchronize FreeBSD large
  dnode code with that in illumos (or newer ZoL).  illumos has a later
  import of the feature from ZoL that does not have the bug.
  
  PR:		236480

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
==============================================================================
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c	Thu Aug 22 06:14:06 2019	(r351382)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c	Thu Aug 22 07:17:49 2019	(r351383)
@@ -1324,7 +1324,9 @@ dnode_hold_impl(objset_t *os, uint64_t object, int fla
 	mutex_enter(&dn->dn_mtx);
 	type = dn->dn_type;
 	if (dn->dn_free_txg ||
-	    ((flag & DNODE_MUST_BE_FREE) && !refcount_is_zero(&dn->dn_holds))) {
+	    ((flag & DNODE_MUST_BE_ALLOCATED) && type == DMU_OT_NONE) ||
+	    ((flag & DNODE_MUST_BE_FREE) &&
+	    (type != DMU_OT_NONE || !refcount_is_zero(&dn->dn_holds)))) {
 		mutex_exit(&dn->dn_mtx);
 		zrl_remove(&dnh->dnh_zrlock);
 		dbuf_rele(db, FTAG);



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