diff usr/src/uts/common/fs/zfs/dmu.c @ 14172:be36a38bac3d

4082 zfs receive gets EFBIG from dmu_tx_hold_free() Reviewed by: Eric Schrock <eric.schrock@delphix.com> Reviewed by: Christopher Siden <christopher.siden@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Approved by: Richard Lowe <richlowe@richlowe.net>
author Matthew Ahrens <mahrens@delphix.com>
date Fri, 30 Aug 2013 01:19:35 -0800
parents dceb17481b99
children
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/dmu.c	Thu Aug 29 10:56:49 2013 -0800
+++ b/usr/src/uts/common/fs/zfs/dmu.c	Fri Aug 30 01:19:35 2013 -0800
@@ -673,6 +673,16 @@
 	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);
 }