1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-02 12:20:51 +00:00

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:
Martin Matuska 2010-05-11 07:25:13 +00:00
parent b27753086c
commit dbbd1505bf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=207908

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