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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:36:49 +0000 (08:36 +0100)
commit7f0d9ac2621e93acdf11723a02be4f24e4f01f0c
tree4e4991adec296f237ad9add0cb27152015ca2c73
parent74f42a77318e8cbf254006c40a6ad3bc53ef6043
dm thin: don't allow changing data device during thin-pool reload

[ Upstream commit 873937e75f9a8ea231a502c3d29d9cb6ad91b3ef ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/dm-thin.c