Skip to content

Commit

Permalink
Fix dirty check in dmu_offset_next()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: George Melikov <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#3125 
Closes openzfs#6867
  • Loading branch information
behlendorf authored Nov 15, 2017
1 parent 13589da commit 454365b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions module/zfs/dmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2250,12 +2250,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;
}
}

Expand Down

0 comments on commit 454365b

Please sign in to comment.