]> git.baikalelectronics.ru Git - kernel.git/commit
dm thin: resume even if in FAIL mode
authorLuo Meng <luomeng12@huawei.com>
Wed, 30 Nov 2022 02:09:45 +0000 (10:09 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:53 +0000 (11:41 +0100)
commitad79fe8f48308d56c9fac315ae038d368ea66f64
treee0ef12865f45ac95c512b6a5a17c8f396a17a13f
parentb7ae981c043375fba0e897b97e664c1ab11548f1
dm thin: resume even if in FAIL mode

[ Upstream commit 19eb1650afeb1aa86151f61900e9e5f1de5d8d02 ]

If a thinpool set fail_io while suspending, resume will fail with:
 device-mapper: resume ioctl on vg-thinpool  failed: Invalid argument

The thin-pool also can't be removed if an in-flight bio is in the
deferred list.

This can be easily reproduced using:

  echo "offline" > /sys/block/sda/device/state
  dd if=/dev/zero of=/dev/mapper/thin bs=4K count=1
  dmsetup suspend /dev/mapper/pool
  mkfs.ext4 /dev/mapper/thin
  dmsetup resume /dev/mapper/pool

The root cause is maybe_resize_data_dev() will check fail_io and return
error before called dm_resume.

Fix this by adding FAIL mode check at the end of pool_preresume().

Cc: stable@vger.kernel.org
Fixes: 4f79c8882c30 ("dm thin metadata: introduce dm_pool_abort_metadata")
Signed-off-by: Luo Meng <luomeng12@huawei.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/dm-thin.c