Skip to content

Commit 048e5a0

Browse files
committed
dm cache metadata: do not allow the data block size to change
The block size for the dm-cache's data device must remained fixed for the life of the cache. Disallow any attempt to change the cache's data block size. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Acked-by: Joe Thornber <ejt@redhat.com> Cc: stable@vger.kernel.org
1 parent 9aec862 commit 048e5a0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/md/dm-cache-metadata.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,15 @@ static int __open_metadata(struct dm_cache_metadata *cmd)
425425

426426
disk_super = dm_block_data(sblock);
427427

428+
/* Verify the data block size hasn't changed */
429+
if (le32_to_cpu(disk_super->data_block_size) != cmd->data_block_size) {
430+
DMERR("changing the data block size (from %u to %llu) is not supported",
431+
le32_to_cpu(disk_super->data_block_size),
432+
(unsigned long long)cmd->data_block_size);
433+
r = -EINVAL;
434+
goto bad;
435+
}
436+
428437
r = __check_incompat_features(disk_super, cmd);
429438
if (r < 0)
430439
goto bad;

0 commit comments

Comments
 (0)