diff options
author | Ned Bass <[email protected]> | 2017-10-02 15:36:04 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-10-02 15:36:04 -0700 |
commit | 39f56627ae988d09b4e3803c01c22b2026b2310e (patch) | |
tree | b127382b7ddaf7f5d7423fbfefe52ab545a41740 /module/zfs/dmu_send.c | |
parent | 01ff0d7540b21c461c19b90b1e715df26cba3ff2 (diff) |
receive_freeobjects() skips freeing some objects
When receiving a FREEOBJECTS record, receive_freeobjects()
incorrectly skips a freed object in some cases. Specifically, this
happens when the first object in the range to be freed doesn't exist,
but the second object does. This leaves an object allocated on disk
on the receiving side which is unallocated on the sending side, which
may cause receiving subsequent incremental streams to fail.
The bug was caused by an incorrect increment of the object index
variable when current object being freed doesn't exist. The
increment is incorrect because incrementing the object index is
handled by a call to dmu_object_next() in the increment portion of
the for loop statement.
Add test case that exposes this bug.
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ned Bass <[email protected]>
Closes #6694
Closes #6695
Diffstat (limited to 'module/zfs/dmu_send.c')
-rw-r--r-- | module/zfs/dmu_send.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c index 359ef99d3..fc63b6e1a 100644 --- a/module/zfs/dmu_send.c +++ b/module/zfs/dmu_send.c @@ -2563,12 +2563,10 @@ receive_freeobjects(struct receive_writer_arg *rwa, int err; err = dmu_object_info(rwa->os, obj, &doi); - if (err == ENOENT) { - obj++; + if (err == ENOENT) continue; - } else if (err != 0) { + else if (err != 0) return (err); - } err = dmu_free_long_object(rwa->os, obj); if (err != 0) |