Fix dirty check in dmu_offset_next()

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
This commit is contained in:
Brian Behlendorf 2017-11-15 10:19:32 -08:00 committed by GitHub
parent 13589da974
commit 454365bbaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -2250,14 +2250,12 @@ dmu_offset_next(objset_t *os, uint64_t object, boolean_t hole, uint64_t *off)
/* /*
* Check if dnode is dirty * Check if dnode is dirty
*/ */
if (dn->dn_dirtyctx != DN_UNDIRTIED) {
for (i = 0; i < TXG_SIZE; i++) { for (i = 0; i < TXG_SIZE; i++) {
if (!list_is_empty(&dn->dn_dirty_records[i])) { if (list_link_active(&dn->dn_dirty_link[i])) {
clean = B_FALSE; clean = B_FALSE;
break; break;
} }
} }
}
/* /*
* If compatibility option is on, sync any current changes before * If compatibility option is on, sync any current changes before