aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/dm-cache-metadata.c4
-rw-r--r--drivers/md/dm-cache-target.c9
-rw-r--r--drivers/md/dm-mpath.c14
-rw-r--r--drivers/md/dm-raid.c2
-rw-r--r--drivers/md/dm-thin-metadata.c6
5 files changed, 20 insertions, 15 deletions
diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
index 69dddeab124c..5936de71883f 100644
--- a/drivers/md/dm-cache-metadata.c
+++ b/drivers/md/dm-cache-metadata.c
@@ -1455,8 +1455,8 @@ static int __load_mappings(struct dm_cache_metadata *cmd,
1455 if (hints_valid) { 1455 if (hints_valid) {
1456 r = dm_array_cursor_next(&cmd->hint_cursor); 1456 r = dm_array_cursor_next(&cmd->hint_cursor);
1457 if (r) { 1457 if (r) {
1458 DMERR("dm_array_cursor_next for hint failed"); 1458 dm_array_cursor_end(&cmd->hint_cursor);
1459 goto out; 1459 hints_valid = false;
1460 } 1460 }
1461 } 1461 }
1462 1462
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index a53413371725..e13d991e9fb5 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -3009,8 +3009,13 @@ static dm_cblock_t get_cache_dev_size(struct cache *cache)
3009 3009
3010static bool can_resize(struct cache *cache, dm_cblock_t new_size) 3010static bool can_resize(struct cache *cache, dm_cblock_t new_size)
3011{ 3011{
3012 if (from_cblock(new_size) > from_cblock(cache->cache_size)) 3012 if (from_cblock(new_size) > from_cblock(cache->cache_size)) {
3013 return true; 3013 if (cache->sized) {
3014 DMERR("%s: unable to extend cache due to missing cache table reload",
3015 cache_device_name(cache));
3016 return false;
3017 }
3018 }
3014 3019
3015 /* 3020 /*
3016 * We can't drop a dirty block when shrinking the cache. 3021 * We can't drop a dirty block when shrinking the cache.
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index d94ba6f72ff5..419362c2d8ac 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -806,19 +806,19 @@ static int parse_path_selector(struct dm_arg_set *as, struct priority_group *pg,
806} 806}
807 807
808static int setup_scsi_dh(struct block_device *bdev, struct multipath *m, 808static int setup_scsi_dh(struct block_device *bdev, struct multipath *m,
809 const char *attached_handler_name, char **error) 809 const char **attached_handler_name, char **error)
810{ 810{
811 struct request_queue *q = bdev_get_queue(bdev); 811 struct request_queue *q = bdev_get_queue(bdev);
812 int r; 812 int r;
813 813
814 if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags)) { 814 if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags)) {
815retain: 815retain:
816 if (attached_handler_name) { 816 if (*attached_handler_name) {
817 /* 817 /*
818 * Clear any hw_handler_params associated with a 818 * Clear any hw_handler_params associated with a
819 * handler that isn't already attached. 819 * handler that isn't already attached.
820 */ 820 */
821 if (m->hw_handler_name && strcmp(attached_handler_name, m->hw_handler_name)) { 821 if (m->hw_handler_name && strcmp(*attached_handler_name, m->hw_handler_name)) {
822 kfree(m->hw_handler_params); 822 kfree(m->hw_handler_params);
823 m->hw_handler_params = NULL; 823 m->hw_handler_params = NULL;
824 } 824 }
@@ -830,7 +830,8 @@ retain:
830 * handler instead of the original table passed in. 830 * handler instead of the original table passed in.
831 */ 831 */
832 kfree(m->hw_handler_name); 832 kfree(m->hw_handler_name);
833 m->hw_handler_name = attached_handler_name; 833 m->hw_handler_name = *attached_handler_name;
834 *attached_handler_name = NULL;
834 } 835 }
835 } 836 }
836 837
@@ -867,7 +868,7 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps
867 struct pgpath *p; 868 struct pgpath *p;
868 struct multipath *m = ti->private; 869 struct multipath *m = ti->private;
869 struct request_queue *q; 870 struct request_queue *q;
870 const char *attached_handler_name; 871 const char *attached_handler_name = NULL;
871 872
872 /* we need at least a path arg */ 873 /* we need at least a path arg */
873 if (as->argc < 1) { 874 if (as->argc < 1) {
@@ -890,7 +891,7 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps
890 attached_handler_name = scsi_dh_attached_handler_name(q, GFP_KERNEL); 891 attached_handler_name = scsi_dh_attached_handler_name(q, GFP_KERNEL);
891 if (attached_handler_name || m->hw_handler_name) { 892 if (attached_handler_name || m->hw_handler_name) {
892 INIT_DELAYED_WORK(&p->activate_path, activate_path_work); 893 INIT_DELAYED_WORK(&p->activate_path, activate_path_work);
893 r = setup_scsi_dh(p->path.dev->bdev, m, attached_handler_name, &ti->error); 894 r = setup_scsi_dh(p->path.dev->bdev, m, &attached_handler_name, &ti->error);
894 if (r) { 895 if (r) {
895 dm_put_device(ti, p->path.dev); 896 dm_put_device(ti, p->path.dev);
896 goto bad; 897 goto bad;
@@ -905,6 +906,7 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps
905 906
906 return p; 907 return p;
907 bad: 908 bad:
909 kfree(attached_handler_name);
908 free_pgpath(p); 910 free_pgpath(p);
909 return ERR_PTR(r); 911 return ERR_PTR(r);
910} 912}
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 5ba067fa0c72..c44925e4e481 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -3353,7 +3353,7 @@ static const char *sync_str(enum sync_state state)
3353}; 3353};
3354 3354
3355/* Return enum sync_state for @mddev derived from @recovery flags */ 3355/* Return enum sync_state for @mddev derived from @recovery flags */
3356static const enum sync_state decipher_sync_action(struct mddev *mddev, unsigned long recovery) 3356static enum sync_state decipher_sync_action(struct mddev *mddev, unsigned long recovery)
3357{ 3357{
3358 if (test_bit(MD_RECOVERY_FROZEN, &recovery)) 3358 if (test_bit(MD_RECOVERY_FROZEN, &recovery))
3359 return st_frozen; 3359 return st_frozen;
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
index 74f6770c70b1..20b0776e39ef 100644
--- a/drivers/md/dm-thin-metadata.c
+++ b/drivers/md/dm-thin-metadata.c
@@ -832,10 +832,8 @@ static void __set_metadata_reserve(struct dm_pool_metadata *pmd)
832 if (r) { 832 if (r) {
833 DMERR("could not get size of metadata device"); 833 DMERR("could not get size of metadata device");
834 pmd->metadata_reserve = max_blocks; 834 pmd->metadata_reserve = max_blocks;
835 } else { 835 } else
836 sector_div(total, 10); 836 pmd->metadata_reserve = min(max_blocks, div_u64(total, 10));
837 pmd->metadata_reserve = min(max_blocks, total);
838 }
839} 837}
840 838
841struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev, 839struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev,