summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2010-05-11 07:25:13 +0000
committermm <mm@FreeBSD.org>2010-05-11 07:25:13 +0000
commit29ba4cd6b8ea727021429b5534a950a23b28771b (patch)
tree3223bdf26922c658d9f57b0dcd1877df7595cc8e
parentbb095a7b971cdea7cd0c50e53166c63d365f00fb (diff)
downloadFreeBSD-src-29ba4cd6b8ea727021429b5534a950a23b28771b.zip
FreeBSD-src-29ba4cd6b8ea727021429b5534a950a23b28771b.tar.gz
Fix endianess bug in ZFS intent log (ZIL).
OpenSolaris onnv revision: 8109:6147a1bdd359 Approved by: pjd, delphij (mentor) Obtained from: OpenSolaris (Bug ID 6760048) MFC after: 3 days
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
index 4455fb8..030e56c 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
@@ -358,14 +358,20 @@ zil_create(zilog_t *zilog)
blk = zh->zh_log;
/*
- * If we don't already have an initial log block, allocate one now.
+ * If we don't already have an initial log block or we have one
+ * but it's the wrong endianness then allocate one.
*/
- if (BP_IS_HOLE(&blk)) {
+ if (BP_IS_HOLE(&blk) || BP_SHOULD_BYTESWAP(&blk)) {
tx = dmu_tx_create(zilog->zl_os);
(void) dmu_tx_assign(tx, TXG_WAIT);
dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx);
txg = dmu_tx_get_txg(tx);
+ if (!BP_IS_HOLE(&blk)) {
+ zio_free_blk(zilog->zl_spa, &blk, txg);
+ BP_ZERO(&blk);
+ }
+
error = zio_alloc_blk(zilog->zl_spa, ZIL_MIN_BLKSZ, &blk,
NULL, txg);
OpenPOWER on IntegriCloud