dm thin: don't allow changing data device during thin-pool reload
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 13 Jan 2020 20:04:37 +0000 (15:04 -0500)
committerMike Snitzer <snitzer@redhat.com>
Wed, 15 Jan 2020 01:22:51 +0000 (20:22 -0500)
commit873937e75f9a8ea231a502c3d29d9cb6ad91b3ef
treeeeec0ff6835692a45d16b9016466f62bf7124b86
parenta4a8d286586d4b28c8517a51db8d86954aadc74b
dm thin: don't allow changing data device during thin-pool reload

The existing code allows changing the data device when the thin-pool
target is reloaded.

This capability is not required and only complicates device lifetime
guarantees. This can cause crashes like the one reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=1788596
where the kernel tries to issue a flush bio located in a structure that
was already freed.

Take the first step to simplifying the thin-pool's data device lifetime
by disallowing changing it. Like the thin-pool's metadata device, the
data device is now set in pool_create() and it cannot be changed for a
given thin-pool.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-thin.c