Commit f1a4a3cd authored by Nikos Tsironis's avatar Nikos Tsironis Committed by Greg Kroah-Hartman
Browse files

dm era: Verify the data block size hasn't changed

commit c8e846ff upstream.

dm-era doesn't support changing the data block size of existing devices,
so check explicitly that the requested block size for a new target
matches the one stored in the metadata.

Fixes: eec40579

 ("dm: add era target")
Cc: # v3.15+
Signed-off-by: default avatarNikos Tsironis <>
Reviewed-by: default avatarMing-Hung Tsai <>
Signed-off-by: Mike Snitzer's avatarMike Snitzer <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent da27b481
......@@ -564,6 +564,15 @@ static int open_metadata(struct era_metadata *md)
disk = dm_block_data(sblock);
/* Verify the data block size hasn't changed */
if (le32_to_cpu(disk->data_block_size) != md->block_size) {
DMERR("changing the data block size (from %u to %llu) is not supported",
le32_to_cpu(disk->data_block_size), md->block_size);
r = -EINVAL;
goto bad;
r = dm_tm_open_with_sm(md->bm, SUPERBLOCK_LOCATION,
......@@ -575,7 +584,6 @@ static int open_metadata(struct era_metadata *md)
md->block_size = le32_to_cpu(disk->data_block_size);
md->nr_blocks = le32_to_cpu(disk->nr_blocks);
md->current_era = le32_to_cpu(disk->current_era);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment