]> git.proxmox.com Git - mirror_zfs.git/blobdiff - module/zfs/dnode_sync.c
Illumos 5117 - spacemap reallocation can cause corruption
[mirror_zfs.git] / module / zfs / dnode_sync.c
index 676578859018ffa1813ea81b4f3745af5d3d84c9..6ad623998c2b6bcb9a65f75e3d1d57d0748bc485 100644 (file)
@@ -695,6 +695,11 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx)
                return;
        }
 
+       if (dn->dn_next_nlevels[txgoff]) {
+               dnode_increase_indirection(dn, tx);
+               dn->dn_next_nlevels[txgoff] = 0;
+       }
+
        if (dn->dn_next_nblkptr[txgoff]) {
                /* this should only happen on a realloc */
                ASSERT(dn->dn_allocated_txg == tx->tx_txg);
@@ -720,11 +725,6 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx)
                mutex_exit(&dn->dn_mtx);
        }
 
-       if (dn->dn_next_nlevels[txgoff]) {
-               dnode_increase_indirection(dn, tx);
-               dn->dn_next_nlevels[txgoff] = 0;
-       }
-
        dbuf_sync_list(list, tx);
 
        if (!DMU_OBJECT_IS_SPECIAL(dn->dn_object)) {