dm: don't change md if dm_table_set_restrictions() fails
[ Upstream commit 9eb7109a ] __bind was changing the disk capacity, geometry and mempools of the mapped device before calling dm_table_set_restrictions() which could fail, forcing dm to drop the new table. Failing here would leave the device using the old table but with the wrong capacity and mempools. Move dm_table_set_restrictions() earlier in __bind(). Since it needs the capacity to be set, save the old version and restore it on failure. Fixes: bb37d772 ("dm: introduce zone append emulation") Reviewed-by:Damien Le Moal <dlemoal@kernel.org> Tested-by:
Damien Le Moal <dlemoal@kernel.org> Signed-off-by:
Benjamin Marzinski <bmarzins@redhat.com> Signed-off-by:
Mikulas Patocka <mpatocka@redhat.com> Signed-off-by:
Sasha Levin <sashal@kernel.org>
Loading