From nobody Sun Apr 24 23:15:39 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 C4F311995FE8; Sun, 24 Apr 2022 23:15:39 +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 4KmkXC4sfjz3M5G; Sun, 24 Apr 2022 23:15:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650842139; 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=GOCHFD7Hj4g31yXumH7Qbh+Soi31I5lUtxAZjaA3qKI=; b=qQfqJZf1mFBaxbehE8WejLnZv4M7JT5ps3H6gWk+gUOoQenpfkCOUGaqUZOalJheymu9bW 7CPcPjIYjBrgUorvOeJK6G90h3bMHvYYiC55wKgD9M2PaJkwA1894EYipXR7EbaEvx7tnF 0oApL8q84ssaXtSTI8UB/cunKDqmSyzjc2R6EaswvTNt7rsm6OL5kOYhld8/A7zpe1s2yK EjgWObcPJ8v49Fx4YBOsW4W82mAOav8Jn/fVRoLMLVL8lmIChcOJygXgSnz4rEGVFJkNQd 6nr6Df6nFpsCnRmINNq1hoe0wfJ23WTE1DqCNqOGqXLU0yBIyCxZ5EALxfEh5g== 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 831DA777D; Sun, 24 Apr 2022 23:15:39 +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 23ONFdW5006053; Sun, 24 Apr 2022 23:15:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23ONFdmw006052; Sun, 24 Apr 2022 23:15:39 GMT (envelope-from git) Date: Sun, 24 Apr 2022 23:15:39 GMT Message-Id: <202204242315.23ONFdmw006052@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: 59288c719dc2 - releng/13.1 - 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/releng/13.1 X-Git-Reftype: branch X-Git-Commit: 59288c719dc2af9b59e33a88f9b138c5bac38335 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650842139; 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=GOCHFD7Hj4g31yXumH7Qbh+Soi31I5lUtxAZjaA3qKI=; b=KZ0uk95l6tYTn4pW1ttOh80J76rGrOOy31R7MJFDvX5QwZi6KugpNOucUzhIVTAmcTJm3C UKDE0ycpPPEqy/k4YVOJrdxDIQN9bkwcBXEv46LIuH7muVypN6n661bFF0TfJTjM6JX9h5 CHYP8p4uWmIcZpuNbalwmYluQc06kQlhITJW04oEkYyMnE4L+FxqpAiun1tvkdwUhWfFv8 pgwJq+mNobaV13RZOe/Q/5VAniRbWU44ql3GP4v/7zFCivPfElb+heIWMibUjOBo1fy/YU RPOmxnrSbrsIx/HiDjMAhWsR3zegh4N8cqxOBG/t0Q40WfLjFJcl+blMk1U8sA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650842139; a=rsa-sha256; cv=none; b=nv06K5Tajs5PsyHxQy2DAL+oaw76Xykq61Zv1vOoTdIySEDavYPs5+eSsiegNs4xswV4pt U7UaPc3SFC1NdwkxQUJg/2mka9hZCMD4opvvSQGY2Tbcwa6nxP4ShesXzroGx6EqP+aFzk 2I1VYFI7+uOxLky6ibcJJUgIBWdkpZqrPG4eJQCOuuyoYolVBB3N67R2AjPnj2nnaSgf4N 8wQbr/acGz47/jBVi614uNcuVvaNVfuC631pYRjPu1+gocIIDsapXsf63uW720AiLwBBtN 9WUvib8r2hWQ9p+MmDOLSlzwqpGUUdwetE02q6txJHY2C+KpvDFa94dpbPSpGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=59288c719dc2af9b59e33a88f9b138c5bac38335 commit 59288c719dc2af9b59e33a88f9b138c5bac38335 Author: Kyle Evans AuthorDate: 2022-04-21 19:57:24 +0000 Commit: Kyle Evans CommitDate: 2022-04-24 23:15:07 +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 Approved by: re (gjb) (cherry picked from commit 914dc91d12198352b7878a88d30e2a6373a936e1) (cherry picked from commit 0c9c8a4c6459a8cd1b7290ae7dcd9452d3a4dbc1) --- 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.