From nobody Fri Dec 01 00:38:47 2023 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 4ShDh725dkz5328D; Fri, 1 Dec 2023 00:38:47 +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 4ShDh71gJtz4MF9; Fri, 1 Dec 2023 00:38:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701391127; 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=IxoRYYuMwRja6UstxGU5NWL4hz0IXMDKV2WRBp2fPWU=; b=yJ0kqzUW/hJ4k8C6PFArFuBnpiSLBrVrYMM8a4fYmDprHBeQP53GCAlydtzigGGESmTuGG /G0b6tqZcDMoVhP7eSZfmFGXMZdz/tFIageedWnLhS4FGqFS3r0d/aPoYkXAXj+UnD91n3 ph7zOS5pd325BXBbe7aw8rQxCGOHHcvJFVRBb7LAtFb6olAHl1Epo/wfXWlQJi6ExwtHc9 v9+xQw/hAj3NviXFwvPsd84IeqgCRzsBKZw48BaIuypqO1wkeg0Jtts53PhRRyLmyvrLto jEDdhGBn++uNNNuF7N5Ar8V+X9yzh9eWo5H4geNjtrQKE8tLpIL7NajGQvQybQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701391127; 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=IxoRYYuMwRja6UstxGU5NWL4hz0IXMDKV2WRBp2fPWU=; b=FsB6B+/5C7N9dHqxpBBFq9aI1OM7+DjCF4P+170ev5JFeVv0zj6sMDt6gmGGp5ILnGVxMp 3ExBOOR0a1vhEBUo66q3iyNkJzvDOn8l93BSccNkJ9tBHb0ZNvLu35qfPuwNlzFFnpMXYk KQMH1MNDkCevF9fFnMA6K0B9MVypXrkbGZi3ZYw7z+lROrxhRqDdGrpeSIoFFEXu3szEBh 8BhhYrM+mGd6WBaqyvnSsoPWH1xrAXlPlT9KPSZR1RoHmlY02YAdZ32cA6myh1YVhVFoet rcqbkfbMHRxsVe3Qp8KeM9SW00Y+O2IuVN9TrYMNWA5AsrqPlVYpfdAPPADA/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701391127; a=rsa-sha256; cv=none; b=wmyyX9GpmzhVhOQgNZk0mEeFlPVBgwVzReNrmxM6cRxPNleoPKOVcVF+DVrQMVbuxhDoF8 KMD2eo5dbvmIpF/rY6rSPTN2Pv+KunnbZJhy/b/3dzq9JuNvEkiEB+mO3ZLBydhcQEUXUb r7W3VCPCVFE17J5aQtNkA7TGu/HE2NXXUBuOOBVpurdXkyZqNrIAmCZ4cv1i089s2NZyrD jL8RA5n8kvk2nCrp3TufJdy06uUe05TCo1JyCPVQrXr+CLSbSPSZN+nybnE5LLXSwJSkEX mTHFaVpEBsRf0PexeH1Lb6jx0BPydz7zNHf4b8szzan1Y8TW59Z9i9F6j4hd3Q== 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 4ShDh70jGhz1BQ3; Fri, 1 Dec 2023 00:38:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3B10cl8T056971; Fri, 1 Dec 2023 00:38:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3B10clb5056968; Fri, 1 Dec 2023 00:38:47 GMT (envelope-from git) Date: Fri, 1 Dec 2023 00:38:47 GMT Message-Id: <202312010038.3B10clb5056968@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 0bb76997ce58 - releng/13.2 - zfs: cherry-pick commit from master 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: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 0bb76997ce5888e8c72aa3fdf036387f85eb240c Auto-Submitted: auto-generated The branch releng/13.2 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=0bb76997ce5888e8c72aa3fdf036387f85eb240c commit 0bb76997ce5888e8c72aa3fdf036387f85eb240c Author: Rob N AuthorDate: 2023-11-28 17:07:57 +0000 Commit: Gordon Tetlow CommitDate: 2023-11-30 21:40:52 +0000 zfs: cherry-pick commit from master #15571 30d581121 dnode_is_dirty: check dnode and its data for dirtiness Obtained from: OpenZFS Approved by: so Security: FreeBSD-EN-23:16.openzfs (cherry picked from commit 30d581121bb122c90959658e7b28b1672d342897) (cherry picked from commit 5858f93a8b66aa6331d99bed6aad68bc7e9648ba) --- sys/contrib/openzfs/module/zfs/dnode.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/contrib/openzfs/module/zfs/dnode.c b/sys/contrib/openzfs/module/zfs/dnode.c index 8e55d5447975..d9a26de5c47a 100644 --- a/sys/contrib/openzfs/module/zfs/dnode.c +++ b/sys/contrib/openzfs/module/zfs/dnode.c @@ -1646,7 +1646,14 @@ dnode_try_claim(objset_t *os, uint64_t object, int slots) } /* - * Checks if the dnode contains any uncommitted dirty records. + * Checks if the dnode itself is dirty, or is carrying any uncommitted records. + * It is important to check both conditions, as some operations (eg appending + * to a file) can dirty both as a single logical unit, but they are not synced + * out atomically, so checking one and not the other can result in an object + * appearing to be clean mid-way through a commit. + * + * Do not change this lightly! If you get it wrong, dmu_offset_next() can + * detect a hole where there is really data, leading to silent corruption. */ boolean_t dnode_is_dirty(dnode_t *dn) @@ -1654,7 +1661,8 @@ dnode_is_dirty(dnode_t *dn) mutex_enter(&dn->dn_mtx); for (int i = 0; i < TXG_SIZE; i++) { - if (multilist_link_active(&dn->dn_dirty_link[i])) { + if (multilist_link_active(&dn->dn_dirty_link[i]) || + !list_is_empty(&dn->dn_dirty_records[i])) { mutex_exit(&dn->dn_mtx); return (B_TRUE); }