]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
receive_freeobjects() skips freeing some objects
authorNed Bass <bass6@llnl.gov>
Mon, 2 Oct 2017 22:36:04 +0000 (15:36 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 2 Oct 2017 22:36:04 +0000 (15:36 -0700)
commit39f56627ae988d09b4e3803c01c22b2026b2310e
treeb127382b7ddaf7f5d7423fbfefe52ab545a41740
parent01ff0d7540b21c461c19b90b1e715df26cba3ff2
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]