]> granicus.if.org Git - zfs/commit
receive_freeobjects() skips freeing some objects
authorNed Bass <bass6@llnl.gov>
Mon, 2 Oct 2017 22:36:04 +0000 (15:36 -0700)
committerTony Hutter <hutter2@llnl.gov>
Mon, 16 Oct 2017 17:57:55 +0000 (10:57 -0700)
commit4cfc086e4ddde787f99489dcfa3cfb0d6127d64c
tree99f6dc2d860bdd68eb959fcd3b0708b85b6639eb
parent25d232f40713604dec1f6f6ef68802ab58115af0
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 <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Closes #6694
Closes #6695
module/zfs/dmu_send.c
tests/runfiles/linux.run
tests/zfs-tests/tests/functional/rsend/Makefile.am
tests/zfs-tests/tests/functional/rsend/send_freeobjects.ksh [new file with mode: 0755]