From nobody Thu Apr 21 19:57:59 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 BDD0C199EF78; Thu, 21 Apr 2022 19:57:59 +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 4KkpHW4sC3z3N8c; Thu, 21 Apr 2022 19:57:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650571079; 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=O8NNzteUDjijmLSpmVFg4MKAPD2qOv5e7hx52t0drps=; b=cJT9NNl/kItj8u/PxHlJpttiX6Cv/3M5s2VknYFzqpBF4AoS3wjEdOMF0i0WaBcT0OJmeJ pOuKdaQoHHVS0rTQ0y1qyJbn2xQ+KqZMDTxXJ16gPTlJ6QGLWXULlXMp5sKkfqVKl2Gq4v wZrALVKHVG3apCc9I0C+jeFogH57IUIKnIOahjbe5aaZC7ANcgMCmOhFOEVpSWgADInkhT EUZ3WV5EWxHd5lVIoeNB0clJyaf+ET0iLO+AaD7i4kX4vo41InjtDg7zLV7jx+2eLQt+t6 jL1vTtTWSdPzwGG0ERcxgEdpLoM9PYsFi/42cYIFgtGK/SztRywhjGwQ+Du5vQ== 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 8674B74B8; Thu, 21 Apr 2022 19:57:59 +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 23LJvx8H003162; Thu, 21 Apr 2022 19:57:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23LJvxMQ003161; Thu, 21 Apr 2022 19:57:59 GMT (envelope-from git) Date: Thu, 21 Apr 2022 19:57:59 GMT Message-Id: <202204211957.23LJvxMQ003161@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 914dc91d1219 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 914dc91d12198352b7878a88d30e2a6373a936e1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650571079; 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=O8NNzteUDjijmLSpmVFg4MKAPD2qOv5e7hx52t0drps=; b=qZYfJXQ2UV+Y05a7HQlcEP+zYNgKQEkhk1DACHggd2E0fIsunxi+5+lFUcdIMsKn7vDUea SwN57fg2SkPwHS8emOKUHSQc40/RSQ8G/NPtUwYZpV2zLQMfz1hsM6FaRXF4hQwdpAtpHh gkY3mUtrh5vKcVSNEt92Y8QSbDjiyxM1+yGZ0LIm3NRNSuxfVthRwXzTNZXw7K2ACbv/gU iBYn3za28LOW9UrX0d65+OZ5pomRUWZrqlHwmUk/MwhKUR0X9TwWUFTqy5pxnBCteKGIH2 2808JualQhJc/51YszM3Bd8SEvrTLMNF5l9kQUOh4NulYmgy+5RY2loz2jSnTg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650571079; a=rsa-sha256; cv=none; b=gZF8sgdckBzQyt6Q2Ez44Qeu2rnoMjagIvM2IRrg4d00OANX8lwM0n///VvIon57pQQ90G 9ADhBZ4vGQ3EelXPP69dGWJ3BUpsE3O9duB6fcHmUMIjjNPwZxuA2gpafvzgqfDy4huljZ cQZ87v6WA4g/aRAgJcSTiOzEJ79nSzkZEPzvmZqSRDZofhiSugPxceBVBbG1rertlTdFEX +w4hYQji85f2bHvkndvbtavevSpFiQw5HLk7hvzkMLoOpb9vd0NyxiH/v/ksew3noZ3R1i vesfWlyJY4b+hwCbGWYqAtGLJqE0SY5HLdVuDfxGyERPjyjE+108dNNjTw16jg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=914dc91d12198352b7878a88d30e2a6373a936e1 commit 914dc91d12198352b7878a88d30e2a6373a936e1 Author: Kyle Evans AuthorDate: 2022-04-21 19:57:24 +0000 Commit: Kyle Evans CommitDate: 2022-04-21 19:57:24 +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 MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D35019 --- 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.