From nobody Sun Apr 24 13:29:21 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id ED3951A86227; Sun, 24 Apr 2022 13:29:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KmTWj4SKHz4t23; Sun, 24 Apr 2022 13:29:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650806961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Fg19O59gJ92oZNimUTjKOz0w4r/UNEgmTyg8kpYSeaA=; b=AMJP6O4HUo2GmIe9UIdjc4QxPsqGHnEhNdbphSa5lzIDU0u2Grq/2ioyeoAoDa3PEt80ok UWq2wcvtXMXVmj1mCC6JBk3+xaS8zOvsJlEF8aO7oQoK/+Dli8GbKuJp8IYrGHgYMESQ9E 5fG1PuirEnZH4JlvxspQjaGrJTraFuYLiDeUFlunO+86j1e3U04naUJL1Vgm7FCAFoXsOH v11Wn/3wuDPs6uwq2O6iiqpLYamRpd2+MJBE9lKbPJB4puQEXNsPU+G2VTQYQwEla2Hj0H EmH6MpMZ80VGWc3AIWLLI4B+AOsdCniuRWjEZn0COwXf9+b9OCnbVTjg0CoBmg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 475E526DDC; Sun, 24 Apr 2022 13:29:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 23ODTLuc010537; Sun, 24 Apr 2022 13:29:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23ODTLvB010535; Sun, 24 Apr 2022 13:29:21 GMT (envelope-from git) Date: Sun, 24 Apr 2022 13:29:21 GMT Message-Id: <202204241329.23ODTLvB010535@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 0c9c8a4c6459 - stable/13 - stand: zfs: handle holes at the tail end correctly List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0c9c8a4c6459a8cd1b7290ae7dcd9452d3a4dbc1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650806961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Fg19O59gJ92oZNimUTjKOz0w4r/UNEgmTyg8kpYSeaA=; b=CfrpUouzj0y3dxlETwuBb/sTzAF6bCK8sYlMOhRdk86aNlBLiZ7nb3YkOvZgRCgPmoXic7 bK9qkYNzvbAt+R6o98wC4uOxNJ/8AnZTHr7jwKPHbo7nWMriEdBybUw761KVchtI6oC1gB L3H4hs3siARbY23jfe7gvNYcBfwkaaolkKVaSTvH5RsRQ8fWePLolD4EiMur1BiLrtmacF KiBKbS5XM1vT76nzHnbi4m2b0B8eUu7OEHEOJ2f6AC22B7iBN/Vkfx2e++kaUr+ryCekcK PYPwiKMfdIQSw53ucafpPjsKvUqxnxmax3jptKAsvpw8Ne4sAFPD8kaTj0V41Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650806961; a=rsa-sha256; cv=none; b=uDA2gey+FgmXlkqVoHQ1mIA7MzrzcQCyuxZFlV6uUWyTto8EM0D5yTrt3dVjqDk70+Bhrj C1dCPcHrePdvDZ06BDOVy0mON10Frycxf8ddsIhv58xufQOPr40hSqwtGRaB/4KBetUo2W 07CV1etmcnde7lBvoj27Y/GEx0D5Z2X5zWE0BdvqiJ5FUJNAYa/apbCRW+aF/MacRt8/++ LJApMXTOYJcTw86xmfQFK7Fe9bd6FMLpn97KwrMt1CJkXXiqmL44O2+U0A5XVQgVHUALVC eUKpdjrOSzhO6Mx8AhIl5NVLUtHrw37OuSOsi9V0TtHeE54Kw1j+Cx2FnjSUng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=0c9c8a4c6459a8cd1b7290ae7dcd9452d3a4dbc1 commit 0c9c8a4c6459a8cd1b7290ae7dcd9452d3a4dbc1 Author: Kyle Evans AuthorDate: 2022-04-21 19:57:24 +0000 Commit: Kyle Evans CommitDate: 2022-04-24 03:51:38 +0000 stand: zfs: handle holes at the tail end correctly This mirrors dmu_read_impl(), zeroing out the tail end of the buffer and clipping the read to what's contained by the block that exists. This fixes an issue that arose during the 13.1 release process; in 13.1-RC1 and later, setting up GELI+ZFS will result in a failure to boot. The culprit is this, which causes us to fail to load geom_eli.ko as there's a residual portion after the single datablk that should be zeroed out. PR: 263407 Reviewed by: tsoome (cherry picked from commit 914dc91d12198352b7878a88d30e2a6373a936e1) --- stand/libsa/zfs/zfsimpl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/stand/libsa/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c index ceaeeb2e77f3..2240eb765c41 100644 --- a/stand/libsa/zfs/zfsimpl.c +++ b/stand/libsa/zfs/zfsimpl.c @@ -2349,6 +2349,19 @@ dnode_read(const spa_t *spa, const dnode_phys_t *dnode, off_t offset, return (EIO); } + /* + * Handle odd block sizes, mirrors dmu_read_impl(). Data can't exist + * past the first block, so we'll clip the read to the portion of the + * buffer within bsize and zero out the remainder. + */ + if (dnode->dn_maxblkid == 0) { + size_t newbuflen; + + newbuflen = offset > bsize ? 0 : MIN(buflen, bsize - offset); + bzero((char *)buf + newbuflen, buflen - newbuflen); + buflen = newbuflen; + } + /* * Note: bsize may not be a power of two here so we need to do an * actual divide rather than a bitshift.