Skip to content

Commit

Permalink
dm cache metadata: do not allow the data block size to change
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Mike Snitzer committed Jul 15, 2014
1 parent 9aec862 commit 048e5a0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/md/dm-cache-metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,15 @@ static int __open_metadata(struct dm_cache_metadata *cmd)

disk_super = dm_block_data(sblock);

/* Verify the data block size hasn't changed */
if (le32_to_cpu(disk_super->data_block_size) != cmd->data_block_size) {
DMERR("changing the data block size (from %u to %llu) is not supported",
le32_to_cpu(disk_super->data_block_size),
(unsigned long long)cmd->data_block_size);
r = -EINVAL;
goto bad;
}

r = __check_incompat_features(disk_super, cmd);
if (r < 0)
goto bad;
Expand Down

0 comments on commit 048e5a0

Please sign in to comment.