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
This commit is contained in:
mm 2010-05-11 07:25:13 +00:00
parent bb095a7b97
commit 29ba4cd6b8

View File

@ -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);