The branch main has been updated by mjg:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=63ee747febbf024be0aace61161241b53245449e

commit 63ee747febbf024be0aace61161241b53245449e
Author:     Mateusz Guzik <[email protected]>
AuthorDate: 2023-04-15 20:24:51 +0000
Commit:     Mateusz Guzik <[email protected]>
CommitDate: 2023-04-15 21:34:54 +0000

    zfs: Revert "ZFS_IOC_COUNT_FILLED does unnecessary txg_wait_synced()"
    
    This reverts commit 519851122b1703b8445ec17bc89b347cea965bb9.
    
    It results in data corruption, see:
    https://github.com/openzfs/zfs/issues/14753
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sys/contrib/openzfs/module/zfs/dnode.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/sys/contrib/openzfs/module/zfs/dnode.c 
b/sys/contrib/openzfs/module/zfs/dnode.c
index 367bfaa80726..d15268cd7bc7 100644
--- a/sys/contrib/openzfs/module/zfs/dnode.c
+++ b/sys/contrib/openzfs/module/zfs/dnode.c
@@ -1764,29 +1764,20 @@ dnode_try_claim(objset_t *os, uint64_t object, int 
slots)
 }
 
 /*
- * Checks if the dnode might contain any uncommitted changes to data blocks.
- * Dirty metadata (e.g. bonus buffer) does not count.
+ * Checks if the dnode contains any uncommitted dirty records.
  */
 boolean_t
 dnode_is_dirty(dnode_t *dn)
 {
        mutex_enter(&dn->dn_mtx);
+
        for (int i = 0; i < TXG_SIZE; i++) {
-               list_t *list = &dn->dn_dirty_records[i];
-               for (dbuf_dirty_record_t *dr = list_head(list);
-                   dr != NULL; dr = list_next(list, dr)) {
-                       if (dr->dr_dbuf == NULL ||
-                           (dr->dr_dbuf->db_blkid != DMU_BONUS_BLKID &&
-                           dr->dr_dbuf->db_blkid != DMU_SPILL_BLKID)) {
-                               mutex_exit(&dn->dn_mtx);
-                               return (B_TRUE);
-                       }
-               }
-               if (dn->dn_free_ranges[i] != NULL) {
+               if (multilist_link_active(&dn->dn_dirty_link[i])) {
                        mutex_exit(&dn->dn_mtx);
                        return (B_TRUE);
                }
        }
+
        mutex_exit(&dn->dn_mtx);
 
        return (B_FALSE);
@@ -2650,9 +2641,7 @@ dnode_next_offset(dnode_t *dn, int flags, uint64_t 
*offset,
                rw_enter(&dn->dn_struct_rwlock, RW_READER);
 
        if (dn->dn_phys->dn_nlevels == 0) {
-               if (!(flags & DNODE_FIND_HOLE)) {
-                       error = SET_ERROR(ESRCH);
-               }
+               error = SET_ERROR(ESRCH);
                goto out;
        }
 

Reply via email to