Skip to content

Commit

Permalink
backport freeobjects receive handling from 0.7
Browse files Browse the repository at this point in the history
this combines changes from

e6d3a84

    OpenZFS 6393 - zfs receive a full send as a clone

and

50c957f

    Implement large_dnode pool feature

to hopefully allow sending regular streams from 0.7.x to 0.6.5.x based
systems.the problematic records of the following kind now no longer lead
to an infinite loop, but instead allow the receive to complete:

drr_type = FREEOBJECTS firstobj = 64 numobjs = 36028797018963904 err = 0

see issues openzfs#5699 (older incompatibility between FreeNAS and <= 0.6.5.11)
and openzfs#6507 (recent incompatibility between 0.7.x and <= 0.6.5.11)
  • Loading branch information
Fabian-Gruenbichler committed Sep 5, 2017
1 parent 2bc71fa commit 677b1f6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions module/zfs/dmu_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -1600,22 +1600,30 @@ restore_freeobjects(struct restorearg *ra, objset_t *os,
struct drr_freeobjects *drrfo)
{
uint64_t obj;
int next_err = 0;

if (drrfo->drr_firstobj + drrfo->drr_numobjs < drrfo->drr_firstobj)
return (SET_ERROR(EINVAL));

for (obj = drrfo->drr_firstobj;
obj < drrfo->drr_firstobj + drrfo->drr_numobjs;
(void) dmu_object_next(os, &obj, FALSE, 0)) {
for (obj = drrfo->drr_firstobj == 0 ? 1 : drrfo->drr_firstobj;
obj < drrfo->drr_firstobj + drrfo->drr_numobjs && next_err == 0;
next_err = dmu_object_next(os, &obj, FALSE, 0)) {
int err;

if (dmu_object_info(os, obj, NULL) != 0)
err = dmu_object_info(os, obj, NULL);
if (err == ENOENT) {
obj++;
continue;
} else if (err != 0) {
return (err);
}

err = dmu_free_long_object(os, obj);
if (err != 0)
return (err);
}
if (next_err != ESRCH)
return (next_err);
return (0);
}

Expand Down

0 comments on commit 677b1f6

Please sign in to comment.