Skip to content

Commit 92bc214

Browse files
ahrensbehlendorf
authored andcommitted
Illumos #4082
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> References: https://www.illumos.org/issues/4082 illumos/illumos-gate@5253393 Ported-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #1775
1 parent ac72fac commit 92bc214

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

module/zfs/dmu.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,16 @@ dmu_free_long_range(objset_t *os, uint64_t object,
672672
if (err != 0)
673673
return (err);
674674
err = dmu_free_long_range_impl(os, dn, offset, length);
675+
676+
/*
677+
* It is important to zero out the maxblkid when freeing the entire
678+
* file, so that (a) subsequent calls to dmu_free_long_range_impl()
679+
* will take the fast path, and (b) dnode_reallocate() can verify
680+
* that the entire file has been freed.
681+
*/
682+
if (offset == 0 && length == DMU_OBJECT_END)
683+
dn->dn_maxblkid = 0;
684+
675685
dnode_rele(dn, FTAG);
676686
return (err);
677687
}

module/zfs/dmu_tx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64_t off, uint64_t len)
633633
*/
634634
if (dn->dn_datablkshift == 0) {
635635
if (off != 0 || len < dn->dn_datablksz)
636-
dmu_tx_count_write(txh, off, len);
636+
dmu_tx_count_write(txh, 0, dn->dn_datablksz);
637637
} else {
638638
/* first block will be modified if it is not aligned */
639639
if (!IS_P2ALIGNED(off, 1 << dn->dn_datablkshift))

0 commit comments

Comments
 (0)