diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-07-18 12:25:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-07-18 12:25:05 -0400 |
commit | 55ae1bd0d2fca3858fdc4bb86c1fc9b79650fe5b (patch) | |
tree | ac8dd2a7c0bd5d5b42cd777d94c148425a49f733 | |
parent | 033ead8230c2cf9cdc2d6e1148bfdf5674012a9c (diff) | |
parent | 048e5a07f282c57815b3901d4a68a77fa131ce0a (diff) |
Merge tag 'dm-3.16-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper fixes from Mike Snitzer:
"Fix the dm-thinp and dm-cache targets to disallow changing the data
device's block size"
* tag 'dm-3.16-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
dm cache metadata: do not allow the data block size to change
dm thin metadata: do not allow the data block size to change
-rw-r--r-- | drivers/md/dm-cache-metadata.c | 9 | ||||
-rw-r--r-- | drivers/md/dm-thin-metadata.c | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c index 4ead4ba60656..d2899e7eb3aa 100644 --- a/drivers/md/dm-cache-metadata.c +++ b/drivers/md/dm-cache-metadata.c | |||
@@ -425,6 +425,15 @@ static int __open_metadata(struct dm_cache_metadata *cmd) | |||
425 | 425 | ||
426 | disk_super = dm_block_data(sblock); | 426 | disk_super = dm_block_data(sblock); |
427 | 427 | ||
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 | |||
428 | r = __check_incompat_features(disk_super, cmd); | 437 | r = __check_incompat_features(disk_super, cmd); |
429 | if (r < 0) | 438 | if (r < 0) |
430 | goto bad; | 439 | goto bad; |
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index b086a945edcb..e9d33ad59df5 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c | |||
@@ -613,6 +613,15 @@ static int __open_metadata(struct dm_pool_metadata *pmd) | |||
613 | 613 | ||
614 | disk_super = dm_block_data(sblock); | 614 | disk_super = dm_block_data(sblock); |
615 | 615 | ||
616 | /* Verify the data block size hasn't changed */ | ||
617 | if (le32_to_cpu(disk_super->data_block_size) != pmd->data_block_size) { | ||
618 | DMERR("changing the data block size (from %u to %llu) is not supported", | ||
619 | le32_to_cpu(disk_super->data_block_size), | ||
620 | (unsigned long long)pmd->data_block_size); | ||
621 | r = -EINVAL; | ||
622 | goto bad_unlock_sblock; | ||
623 | } | ||
624 | |||
616 | r = __check_incompat_features(disk_super, pmd); | 625 | r = __check_incompat_features(disk_super, pmd); |
617 | if (r < 0) | 626 | if (r < 0) |
618 | goto bad_unlock_sblock; | 627 | goto bad_unlock_sblock; |