Skip to content

Commit 397f816

Browse files
backport freeobjects receive handling from 0.7
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 #5699 (older incompatibility between FreeNAS and <= 0.6.5.11) and #6507 (recent incompatibility between 0.7.x and <= 0.6.5.11) Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Requires-spl: refs/pull/647/head
1 parent 2bc71fa commit 397f816

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

module/zfs/dmu_send.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,22 +1600,30 @@ restore_freeobjects(struct restorearg *ra, objset_t *os,
16001600
struct drr_freeobjects *drrfo)
16011601
{
16021602
uint64_t obj;
1603+
int next_err = 0;
16031604

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

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

1612-
if (dmu_object_info(os, obj, NULL) != 0)
1613+
err = dmu_object_info(os, obj, NULL);
1614+
if (err == ENOENT) {
1615+
obj++;
16131616
continue;
1617+
} else if (err != 0) {
1618+
return (err);
1619+
}
16141620

16151621
err = dmu_free_long_object(os, obj);
16161622
if (err != 0)
16171623
return (err);
16181624
}
1625+
if (next_err != ESRCH)
1626+
return (next_err);
16191627
return (0);
16201628
}
16211629

0 commit comments

Comments
 (0)