]> granicus.if.org Git - zfs/commitdiff
Fix dirty check in dmu_offset_next()
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 15 Nov 2017 18:19:32 +0000 (10:19 -0800)
committerTony Hutter <hutter2@llnl.gov>
Tue, 21 Nov 2017 19:11:29 +0000 (13:11 -0600)
The correct way to determine if a dnode is dirty is to check
if any of the dn->dn_dirty_link's are active.  Relying solely
on the dn->dn_dirtyctx can result in the dnode being mistakenly
reported as clean.

Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3125
Closes #6867

module/zfs/dmu.c

index 44705006eb97d200e74bf0ab76fbb19b2e81f89c..6f09aa2f7688f791e76a51777c53b6c9a0772c77 100644 (file)
@@ -2043,12 +2043,10 @@ dmu_offset_next(objset_t *os, uint64_t object, boolean_t hole, uint64_t *off)
        /*
         * Check if dnode is dirty
         */
-       if (dn->dn_dirtyctx != DN_UNDIRTIED) {
-               for (i = 0; i < TXG_SIZE; i++) {
-                       if (!list_is_empty(&dn->dn_dirty_records[i])) {
-                               clean = B_FALSE;
-                               break;
-                       }
+       for (i = 0; i < TXG_SIZE; i++) {
+               if (list_link_active(&dn->dn_dirty_link[i])) {
+                       clean = B_FALSE;
+                       break;
                }
        }