Illumos #764: panic in zfs:dbuf_sync_list
[zfs.git] / module / zfs / zil.c
index 751806d..8aa811d 100644 (file)
@@ -74,7 +74,7 @@ int zil_replay_disable = 0;    /* disable intent logging replay */
  * zfs_nocacheflush will cause corruption on power loss if a volatile
  * out-of-order write cache is enabled.
  */
-boolean_t zfs_nocacheflush = B_FALSE;
+int zfs_nocacheflush = 0;
 
 static kmem_cache_t *zil_lwb_cache;
 
@@ -296,6 +296,8 @@ zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func,
        char *lrbuf, *lrp;
        int error = 0;
 
+       bzero(&next_blk, sizeof(blkptr_t));
+
        /*
         * Old logs didn't record the maximum zh_claim_lr_seq.
         */
@@ -317,7 +319,7 @@ zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func,
        for (blk = zh->zh_log; !BP_IS_HOLE(&blk); blk = next_blk) {
                uint64_t blk_seq = blk.blk_cksum.zc_word[ZIL_ZC_SEQ];
                int reclen;
-               char *end;
+               char *end = NULL;
 
                if (blk_seq > claim_blk_seq)
                        break;
@@ -1073,7 +1075,8 @@ zil_itx_create(uint64_t txtype, size_t lrsize)
 
        lrsize = P2ROUNDUP_TYPED(lrsize, sizeof (uint64_t), size_t);
 
-       itx = kmem_alloc(offsetof(itx_t, itx_lr) + lrsize, KM_SLEEP);
+       itx = kmem_alloc(offsetof(itx_t, itx_lr) + lrsize,
+           KM_PUSHPAGE | KM_NODEBUG);
        itx->itx_lr.lrc_txtype = txtype;
        itx->itx_lr.lrc_reclen = lrsize;
        itx->itx_sod = lrsize; /* if write & WR_NEED_COPY will be increased */
@@ -1937,7 +1940,7 @@ zil_replay(objset_t *os, void *arg, zil_replay_func_t *replay_func[TX_MAX_TYPE])
        zr.zr_replay = replay_func;
        zr.zr_arg = arg;
        zr.zr_byteswap = BP_SHOULD_BYTESWAP(&zh->zh_log);
-       zr.zr_lr = kmem_alloc(2 * SPA_MAXBLOCKSIZE, KM_SLEEP);
+       zr.zr_lr = vmem_alloc(2 * SPA_MAXBLOCKSIZE, KM_SLEEP);
 
        /*
         * Wait for in-progress removes to sync before starting replay.
@@ -1949,7 +1952,7 @@ zil_replay(objset_t *os, void *arg, zil_replay_func_t *replay_func[TX_MAX_TYPE])
        ASSERT(zilog->zl_replay_blks == 0);
        (void) zil_parse(zilog, zil_incr_blks, zil_replay_log_record, &zr,
            zh->zh_claim_txg);
-       kmem_free(zr.zr_lr, 2 * SPA_MAXBLOCKSIZE);
+       vmem_free(zr.zr_lr, 2 * SPA_MAXBLOCKSIZE);
 
        zil_destroy(zilog, B_FALSE);
        txg_wait_synced(zilog->zl_dmu_pool, zilog->zl_destroy_txg);
@@ -1992,3 +1995,11 @@ zil_vdev_offline(const char *osname, void *arg)
        dmu_objset_rele(os, FTAG);
        return (error);
 }
+
+#if defined(_KERNEL) && defined(HAVE_SPL)
+module_param(zil_replay_disable, int, 0644);
+MODULE_PARM_DESC(zil_replay_disable, "Disable intent logging replay");
+
+module_param(zfs_nocacheflush, int, 0644);
+MODULE_PARM_DESC(zfs_nocacheflush, "Disable cache flushes");
+#endif