aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/dmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'module/zfs/dmu.c')
-rw-r--r--module/zfs/dmu.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c
index 1136e1d70..72fce35c5 100644
--- a/module/zfs/dmu.c
+++ b/module/zfs/dmu.c
@@ -672,6 +672,16 @@ dmu_free_long_range(objset_t *os, uint64_t object,
if (err != 0)
return (err);
err = dmu_free_long_range_impl(os, dn, offset, length);
+
+ /*
+ * It is important to zero out the maxblkid when freeing the entire
+ * file, so that (a) subsequent calls to dmu_free_long_range_impl()
+ * will take the fast path, and (b) dnode_reallocate() can verify
+ * that the entire file has been freed.
+ */
+ if (offset == 0 && length == DMU_OBJECT_END)
+ dn->dn_maxblkid = 0;
+
dnode_rele(dn, FTAG);
return (err);
}