From nobody Sun Apr 24 13:29:25 2022 X-Original-To: dev-commits-src-branches@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 7DFA61A8649D; Sun, 24 Apr 2022 13:29:26 +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 4KmTWp0640z4t9v; Sun, 24 Apr 2022 13:29:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650806966; 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=RDvM6KJatLrwDXEvjB5KanJO1qwNw4Ax5uzZYRgksu4=; b=JthNgT+R+5I9uU9SCkMGCcZU9fzW+XwezfmA8Q9oLLXibdI5SpVk04m7Ygo4rYUdu86se/ V86F8X4EwuqEWM9ysPH1qioR1ber593GV0bobiN0MrZXjhZILJCD9lDjIgLlED41IvD5/3 DaFvvGgrceOcUJAJvTzD540+uiuT43Djk6lmwUU9sXCLdFg8AWIehw5ef9FWurU1cVZGmn L841TVGYePLtk5lAJ+ioDhXdYTu7Cs/oIEW4ZObHXUFPVRMdy8Yq/7V8HSaZiqkqeIMWES WoZYj5FEdBuXswntEzIls3zebNmYyo4PvNyoogmXKU6VvWLUqdnDEOt7LbJBTQ== 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 A650226DDE; Sun, 24 Apr 2022 13:29:25 +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 23ODTPSA010737; Sun, 24 Apr 2022 13:29:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23ODTPMK010736; Sun, 24 Apr 2022 13:29:25 GMT (envelope-from git) Date: Sun, 24 Apr 2022 13:29:25 GMT Message-Id: <202204241329.23ODTPMK010736@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: 9a1efa766781 - stable/12 - stand: zfs: handle holes at the tail end correctly List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/12 X-Git-Reftype: branch X-Git-Commit: 9a1efa766781c9dd1eb5975ce3a5c8a64d89cd18 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650806966; 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=RDvM6KJatLrwDXEvjB5KanJO1qwNw4Ax5uzZYRgksu4=; b=Na9id72LMgxn5wtv883GrrOg3FaxNi1SSjW9CzM2G2jJ05I2oQdC3SdsCSRTG4xwhj35CZ Cmhtuwy2okiYCn6PZt0sHMLCI1oN3zUp+9Zrzh4G3Y9adMaeLSgabc5MdTGWfNHGeFwLyz fgBpH4P/L7hB75U7h+b3FYG7qAeG6XisTT9D9yim3VeTpDKXJjPiewLAbjb+P5XQO+jpRm 1TrKc64UbJ8k7n1QamxAneH4m+pLWYal8Jd17ZkTIixJlcSEHFcM4ZUxcQjs4+U08EH4YZ SpmBqtSRSqfQt4eABiSCSopLFoXieC6cHnNU4WgKoFV8BwS+3IPnUS8uyP3Atg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650806966; a=rsa-sha256; cv=none; b=ihVlpqujmPfQWQTbcAuaQ4MqakWHgQFsrDXeCUIEvDMWQicMB3H+fOcYp2AdpD0e5Py0Zm RBhUJ9eCXxmGHV/WI9/+526jarieLSyHpmOU39bXGQehLyCbQq4y268RUQxTYxiFj5Kuye tx3PQcRGjN2nHal+CiZKifQr9Rz4wd7HvANCLV90bjIsRfhvPfRINK3gjDlaFo6cOQDVVy lSgYW+0fKFTXPiZcByDT4zWh/ghA59wk/m1PZGrKuCOIAqwawjrNvS+56ZJYpH5Q954KzY KjFCgoqjKuE9Nt+tia1mYQB7GFPbZeM54sfVg3fp7MJsyfvfZr9YZxkxXSZXFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=9a1efa766781c9dd1eb5975ce3a5c8a64d89cd18 commit 9a1efa766781c9dd1eb5975ce3a5c8a64d89cd18 Author: Kyle Evans AuthorDate: 2022-04-21 19:57:24 +0000 Commit: Kyle Evans CommitDate: 2022-04-24 03:49:22 +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 6c46bfdaea9c..33f23f88f13a 100644 --- a/stand/libsa/zfs/zfsimpl.c +++ b/stand/libsa/zfs/zfsimpl.c @@ -2065,6 +2065,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.