dm clone metadata: Track exact changes per transaction
authorNikos Tsironis <ntsironis@arrikto.com>
Wed, 4 Dec 2019 14:06:52 +0000 (16:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 21 Dec 2019 10:04:59 +0000 (11:04 +0100)
commitaeb8a795f6d577606293e7ddc11ab00d160bfe4b
tree228ad0a570764f725b39df68435bec36b3eb0eea
parent3f07f8a999f32746291f1b8300bf293637283919
dm clone metadata: Track exact changes per transaction

commit e6a505f3f9fae572fb3ab3bc486e755ac9cef32c upstream.

Extend struct dirty_map with a second bitmap which tracks the exact
regions that were hydrated during the current metadata transaction.

Moreover, fix __flush_dmap() to only commit the metadata of the regions
that were hydrated during the current transaction.

This is required by the following commits to fix a data corruption bug.

Fixes: 7431b7835f55 ("dm: add clone target")
Cc: stable@vger.kernel.org # v5.4+
Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-clone-metadata.c