From owner-freebsd-current@FreeBSD.ORG Sat Aug 6 23:36:06 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 229A21065670 for ; Sat, 6 Aug 2011 23:36:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) by mx1.freebsd.org (Postfix) with ESMTP id D29648FC0C for ; Sat, 6 Aug 2011 23:36:05 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:1d9d:8e25:c6d2:18db] (unknown [IPv6:2001:7b8:3a7:0:1d9d:8e25:c6d2:18db]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id B8E2D5C37; Sun, 7 Aug 2011 01:35:31 +0200 (CEST) Message-ID: <4E3DCFC8.7000802@FreeBSD.org> Date: Sun, 07 Aug 2011 01:35:36 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Test Rat References: <86zkjtwc8r.fsf@gmail.com> <86vcucfnt3.fsf@gmail.com> In-Reply-To: <86vcucfnt3.fsf@gmail.com> Content-Type: multipart/mixed; boundary="------------020600000003040704020902" Cc: freebsd-current@freebsd.org Subject: Re: [clang] (gpt)zfsboot is broken: zfs_alloc()/zfs_free() mismatch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2011 23:36:06 -0000 This is a multi-part message in MIME format. --------------020600000003040704020902 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2011-08-05 07:08, Test Rat wrote: > Pawel Worach 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. :) --------------020600000003040704020902 Content-Type: text/plain; name="fix-gptzfsboot-clang-failure-2.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix-gptzfsboot-clang-failure-2.diff" 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); } --------------020600000003040704020902--