Author: avg
Date: Tue Aug  8 10:48:52 2017
New Revision: 322228
URL: https://svnweb.freebsd.org/changeset/base/322228

Log:
  MFV r322227: 8377 Panic in bookmark deletion
  
  illumos/illumos-gate@42418f9e73f0d007aa87675ecc206c26fc8e073e
  
https://github.com/illumos/illumos-gate/commit/42418f9e73f0d007aa87675ecc206c26fc8e073e
  
  https://www.illumos.org/issues/8377
    The problem is that when dsl_bookmark_destroy_check() is executed from open
    context (the pre-check), it fills in dbda_success based on the existence of 
the
    bookmark.
    But the bookmark (or containing filesystem as in this case) can be destroyed
    before we get to syncing context. When we re-run 
dsl_bookmark_destroy_check()
    in syncing
    context, it will not add the deleted bookmark to dbda_success, intending for
    dsl_bookmark_destroy_sync() to not process it. But because the bookmark is
    still in dbda_success
    from the open-context call, we do try to destroy it.
    The fix is that dsl_bookmark_destroy_check() should not modify dbda_success
    when called from open context.
  
  Reviewed by: Paul Dagnelie <p...@delphix.com>
  Reviewed by: Pavel Zakharov <pavel.zakha...@delphix.com>
  Reviewed by: George Wilson <george.wil...@delphix.com>
  Approved by: Robert Mustacchi <r...@joyent.com>
  Author: Matthew Ahrens <mahr...@delphix.com>
  
  MFC after:    2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c  Tue Aug 
 8 10:47:56 2017        (r322227)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c  Tue Aug 
 8 10:48:52 2017        (r322228)
@@ -354,6 +354,9 @@ dsl_bookmark_destroy_check(void *arg, dmu_tx_t *tx)
        dsl_pool_t *dp = dmu_tx_pool(tx);
        int rv = 0;
 
+       ASSERT(nvlist_empty(dbda->dbda_success));
+       ASSERT(nvlist_empty(dbda->dbda_errors));
+
        if (!spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_BOOKMARKS))
                return (0);
 
@@ -383,7 +386,10 @@ dsl_bookmark_destroy_check(void *arg, dmu_tx_t *tx)
                        }
                }
                if (error == 0) {
-                       fnvlist_add_boolean(dbda->dbda_success, fullname);
+                       if (dmu_tx_is_syncing(tx)) {
+                               fnvlist_add_boolean(dbda->dbda_success,
+                                   fullname);
+                       }
                } else {
                        fnvlist_add_int32(dbda->dbda_errors, fullname, error);
                        rv = error;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to