[clang] (gpt)zfsboot is broken: zfs_alloc()/zfs_free() mismatch

Dimitry Andric dim at FreeBSD.org
Sat Aug 6 23:36:06 UTC 2011


On 2011-08-05 07:08, Test Rat wrote:
> Pawel Worach<pawel.worach at gmail.com>  writes:
...
>> A workaround for the hang on boot and "error 1 lba X" failures is the
>> following patch, it would be interesting if it also makes the
>> zfs_alloc/free error go away too.
> After applying the patch zfsboot and gptzfsboot boot successfully.
> Tested both inside qemu and only gptzfsboot on a living system.

Hi,

Can you please try the following alternative patch, which should fix the
problem without disabling -mrtd?  E.g. revert the previous patch, then
apply this one.

Of course, if any other posters in this thread that had problems with
gptzfsboot (or 'plain' zfsboot) can also confirm this patch works, it
would be nice. :)
-------------- next part --------------
Index: sys/boot/zfs/zfsimpl.c
===================================================================
--- sys/boot/zfs/zfsimpl.c	(revision 224560)
+++ sys/boot/zfs/zfsimpl.c	(working copy)
@@ -949,10 +949,10 @@ vdev_probe(vdev_phys_read_t *read, void *read_priv
 		if (up->ub_txg < spa->spa_txg)
 			continue;
 		if (up->ub_txg > spa->spa_uberblock.ub_txg) {
-			spa->spa_uberblock = *up;
+			memcpy(&spa->spa_uberblock, up, sizeof(*up));
 		} else if (up->ub_txg == spa->spa_uberblock.ub_txg) {
 			if (up->ub_timestamp > spa->spa_uberblock.ub_timestamp)
-				spa->spa_uberblock = *up;
+				memcpy(&spa->spa_uberblock, up, sizeof(*up));
 		}
 	}
 	zfs_free(upbuf, VDEV_UBERBLOCK_SIZE(vdev));
@@ -1703,6 +1703,6 @@ zfs_lookup(spa_t *spa, const char *upath, dnode_ph
 		}
 	}
 
-	*dnode = dn;
+	memcpy(dnode, &dn, sizeof(dn));
 	return (0);
 }


More information about the freebsd-current mailing list