Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 610bba8b authored by Alasdair G Kergon's avatar Alasdair G Kergon
Browse files

dm thin: fix metadata dev resize detection



Fix detection of the need to resize the dm thin metadata device.

The code incorrectly tried to extend the metadata device when it
didn't need to due to a merging error with patch 24347e95 ("dm thin:
detect metadata device resizing").

  device-mapper: transaction manager: couldn't open metadata space map
  device-mapper: thin metadata: tm_open_with_sm failed
  device-mapper: thin: aborting transaction failed
  device-mapper: thin: switching pool to failure mode

Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent f722406f
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -2188,7 +2188,7 @@ static int maybe_resize_metadata_dev(struct dm_target *ti, bool *need_commit)


	*need_commit = false;
	*need_commit = false;


	metadata_dev_size = get_metadata_dev_size(pool->md_dev);
	metadata_dev_size = get_metadata_dev_size_in_blocks(pool->md_dev);


	r = dm_pool_get_metadata_dev_size(pool->pmd, &sb_metadata_dev_size);
	r = dm_pool_get_metadata_dev_size(pool->pmd, &sb_metadata_dev_size);
	if (r) {
	if (r) {
@@ -2197,7 +2197,7 @@ static int maybe_resize_metadata_dev(struct dm_target *ti, bool *need_commit)
	}
	}


	if (metadata_dev_size < sb_metadata_dev_size) {
	if (metadata_dev_size < sb_metadata_dev_size) {
		DMERR("metadata device (%llu sectors) too small: expected %llu",
		DMERR("metadata device (%llu blocks) too small: expected %llu",
		      metadata_dev_size, sb_metadata_dev_size);
		      metadata_dev_size, sb_metadata_dev_size);
		return -EINVAL;
		return -EINVAL;