Skip to content

Commit

Permalink
skip FREEOBJECTS for objects which can't exist
Browse files Browse the repository at this point in the history
when sending an incremental stream based on a snapshot, the receiving
side must have the same base snapshot. thus we do not need to send
FREEOBJECTS records for any objects past the maximum one which exists
locally.

this allows us to send incremental streams (again) to older ZFS
implementations (e.g. ZoL < 0.7) which actually try to free all objects
in a FREEOBJECTS record, instead of bailing out early.

Signed-off-by: Fabian Grünbichler <[email protected]>
  • Loading branch information
Fabian-Gruenbichler committed Oct 3, 2017
1 parent 39f5662 commit 4adab0c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions module/zfs/dmu_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,22 @@ static int
dump_freeobjects(dmu_sendarg_t *dsp, uint64_t firstobj, uint64_t numobjs)
{
struct drr_freeobjects *drrfo = &(dsp->dsa_drr->drr_u.drr_freeobjects);
uint64_t maxobj = DNODES_PER_BLOCK *
(DMU_META_DNODE(dsp->dsa_os)->dn_maxblkid + 1);

/*
* ZoL < 0.7 does not handle large FREEOBJECTS records correctly,
* leading to zfs recv never completing. to avoid this issue, don't
* send FREEOBJECTS records for object IDs which cannot exist on the
* receiving side.
*/
if (maxobj > 0) {
if (maxobj < firstobj)
return (0);

if (maxobj < firstobj + numobjs)
numobjs = maxobj - firstobj;
}

/*
* If there is a pending op, but it's not PENDING_FREEOBJECTS,
Expand Down

0 comments on commit 4adab0c

Please sign in to comment.