summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorMatthew Ahrens <mahrens@delphix.com>2013-08-30 01:19:35 -0800
committerChristopher Siden <chris.siden@delphix.com>2013-08-30 02:19:35 -0700
commit5253393b09789ec67bec153b866d7285a1cf1645 (patch)
treee9eb71f00edf38406bcaafa55590a25192015b65 /usr/src
parent22e30981d82a0b6dc89253596ededafae8655e00 (diff)
downloadillumos-joyent-5253393b09789ec67bec153b866d7285a1cf1645.tar.gz
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>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/common/fs/zfs/dmu.c10
-rw-r--r--usr/src/uts/common/fs/zfs/dmu_tx.c3
2 files changed, 11 insertions, 2 deletions
diff --git a/usr/src/uts/common/fs/zfs/dmu.c b/usr/src/uts/common/fs/zfs/dmu.c
index 1a7559484d..428e74102a 100644
--- a/usr/src/uts/common/fs/zfs/dmu.c
+++ b/usr/src/uts/common/fs/zfs/dmu.c
@@ -673,6 +673,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);
}
diff --git a/usr/src/uts/common/fs/zfs/dmu_tx.c b/usr/src/uts/common/fs/zfs/dmu_tx.c
index a2eeb16afc..44350f7b3b 100644
--- a/usr/src/uts/common/fs/zfs/dmu_tx.c
+++ b/usr/src/uts/common/fs/zfs/dmu_tx.c
@@ -605,7 +605,6 @@ dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64_t off, uint64_t len)
if (len == DMU_OBJECT_END)
len = (dn->dn_maxblkid+1) * dn->dn_datablksz - off;
-
/*
* For i/o error checking, we read the first and last level-0
* blocks if they are not aligned, and all the level-1 blocks.
@@ -617,7 +616,7 @@ dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64_t off, uint64_t len)
*/
if (dn->dn_datablkshift == 0) {
if (off != 0 || len < dn->dn_datablksz)
- dmu_tx_count_write(txh, off, len);
+ dmu_tx_count_write(txh, 0, dn->dn_datablksz);
} else {
/* first block will be modified if it is not aligned */
if (!IS_P2ALIGNED(off, 1 << dn->dn_datablkshift))