diff options
author | Heinz Mauelshagen <heinzm@redhat.com> | 2016-10-18 11:46:45 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2016-11-21 09:52:05 -0500 |
commit | 453c2a8967e582212eaf68c80fa8256d41b94fc9 (patch) | |
tree | 1698507631f98f05f31f0d49cd3249e645c062e6 /drivers/md/dm-raid.c | |
parent | bb1423a96f064f429a3c30abf9dce3c834d5a2a3 (diff) |
dm raid: correct error messages on old metadata validation
When target 1.9.1 gets takeover/reshape requests on devices with old superblock
format not supporting such conversions and rejects them in super_init_validation(),
it logs bogus error message (e.g. Reshape when a takeover is requested).
Whilst on it, add messages for disk adding/removing and stripe sectors
reshape requests, use the newer rs_{takeover,reshape}_requested() API,
address a raid10 false positive in checking array positions and
remove rs_set_new() because device members are already set proper.
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-raid.c')
-rw-r--r-- | drivers/md/dm-raid.c | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 6d53810963f7..698b03e9d955 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c | |||
@@ -2050,16 +2050,17 @@ static int super_init_validation(struct raid_set *rs, struct md_rdev *rdev) | |||
2050 | 2050 | ||
2051 | mddev->reshape_position = MaxSector; | 2051 | mddev->reshape_position = MaxSector; |
2052 | 2052 | ||
2053 | mddev->raid_disks = le32_to_cpu(sb->num_devices); | ||
2054 | mddev->level = le32_to_cpu(sb->level); | ||
2055 | mddev->layout = le32_to_cpu(sb->layout); | ||
2056 | mddev->chunk_sectors = le32_to_cpu(sb->stripe_sectors); | ||
2057 | |||
2053 | /* | 2058 | /* |
2054 | * Reshaping is supported, e.g. reshape_position is valid | 2059 | * Reshaping is supported, e.g. reshape_position is valid |
2055 | * in superblock and superblock content is authoritative. | 2060 | * in superblock and superblock content is authoritative. |
2056 | */ | 2061 | */ |
2057 | if (le32_to_cpu(sb->compat_features) & FEATURE_FLAG_SUPPORTS_V190) { | 2062 | if (le32_to_cpu(sb->compat_features) & FEATURE_FLAG_SUPPORTS_V190) { |
2058 | /* Superblock is authoritative wrt given raid set layout! */ | 2063 | /* Superblock is authoritative wrt given raid set layout! */ |
2059 | mddev->raid_disks = le32_to_cpu(sb->num_devices); | ||
2060 | mddev->level = le32_to_cpu(sb->level); | ||
2061 | mddev->layout = le32_to_cpu(sb->layout); | ||
2062 | mddev->chunk_sectors = le32_to_cpu(sb->stripe_sectors); | ||
2063 | mddev->new_level = le32_to_cpu(sb->new_level); | 2064 | mddev->new_level = le32_to_cpu(sb->new_level); |
2064 | mddev->new_layout = le32_to_cpu(sb->new_layout); | 2065 | mddev->new_layout = le32_to_cpu(sb->new_layout); |
2065 | mddev->new_chunk_sectors = le32_to_cpu(sb->new_stripe_sectors); | 2066 | mddev->new_chunk_sectors = le32_to_cpu(sb->new_stripe_sectors); |
@@ -2087,38 +2088,44 @@ static int super_init_validation(struct raid_set *rs, struct md_rdev *rdev) | |||
2087 | /* | 2088 | /* |
2088 | * No takeover/reshaping, because we don't have the extended v1.9.0 metadata | 2089 | * No takeover/reshaping, because we don't have the extended v1.9.0 metadata |
2089 | */ | 2090 | */ |
2090 | if (le32_to_cpu(sb->level) != mddev->new_level) { | 2091 | struct raid_type *rt_cur = get_raid_type_by_ll(mddev->level, mddev->layout); |
2091 | DMERR("Reshaping/takeover raid sets not yet supported. (raid level/stripes/size change)"); | 2092 | struct raid_type *rt_new = get_raid_type_by_ll(mddev->new_level, mddev->new_layout); |
2092 | return -EINVAL; | ||
2093 | } | ||
2094 | if (le32_to_cpu(sb->layout) != mddev->new_layout) { | ||
2095 | DMERR("Reshaping raid sets not yet supported. (raid layout change)"); | ||
2096 | DMERR(" 0x%X vs 0x%X", le32_to_cpu(sb->layout), mddev->layout); | ||
2097 | DMERR(" Old layout: %s w/ %d copies", | ||
2098 | raid10_md_layout_to_format(le32_to_cpu(sb->layout)), | ||
2099 | raid10_md_layout_to_copies(le32_to_cpu(sb->layout))); | ||
2100 | DMERR(" New layout: %s w/ %d copies", | ||
2101 | raid10_md_layout_to_format(mddev->layout), | ||
2102 | raid10_md_layout_to_copies(mddev->layout)); | ||
2103 | return -EINVAL; | ||
2104 | } | ||
2105 | if (le32_to_cpu(sb->stripe_sectors) != mddev->new_chunk_sectors) { | ||
2106 | DMERR("Reshaping raid sets not yet supported. (stripe sectors change)"); | ||
2107 | return -EINVAL; | ||
2108 | } | ||
2109 | 2093 | ||
2110 | /* We can only change the number of devices in raid1 with old (i.e. pre 1.0.7) metadata */ | 2094 | if (rs_takeover_requested(rs)) { |
2111 | if (!rt_is_raid1(rs->raid_type) && | 2095 | if (rt_cur && rt_new) |
2112 | (le32_to_cpu(sb->num_devices) != mddev->raid_disks)) { | 2096 | DMERR("Takeover raid sets from %s to %s not yet supported by metadata. (raid level change)", |
2113 | DMERR("Reshaping raid sets not yet supported. (device count change from %u to %u)", | 2097 | rt_cur->name, rt_new->name); |
2114 | sb->num_devices, mddev->raid_disks); | 2098 | else |
2099 | DMERR("Takeover raid sets not yet supported by metadata. (raid level change)"); | ||
2100 | return -EINVAL; | ||
2101 | } else if (rs_reshape_requested(rs)) { | ||
2102 | DMERR("Reshaping raid sets not yet supported by metadata. (raid layout change keeping level)"); | ||
2103 | if (mddev->layout != mddev->new_layout) { | ||
2104 | if (rt_cur && rt_new) | ||
2105 | DMERR(" current layout %s vs new layout %s", | ||
2106 | rt_cur->name, rt_new->name); | ||
2107 | else | ||
2108 | DMERR(" current layout 0x%X vs new layout 0x%X", | ||
2109 | le32_to_cpu(sb->layout), mddev->new_layout); | ||
2110 | } | ||
2111 | if (mddev->chunk_sectors != mddev->new_chunk_sectors) | ||
2112 | DMERR(" current stripe sectors %u vs new stripe sectors %u", | ||
2113 | mddev->chunk_sectors, mddev->new_chunk_sectors); | ||
2114 | if (rs->delta_disks) | ||
2115 | DMERR(" current %u disks vs new %u disks", | ||
2116 | mddev->raid_disks, mddev->raid_disks + rs->delta_disks); | ||
2117 | if (rs_is_raid10(rs)) { | ||
2118 | DMERR(" Old layout: %s w/ %u copies", | ||
2119 | raid10_md_layout_to_format(mddev->layout), | ||
2120 | raid10_md_layout_to_copies(mddev->layout)); | ||
2121 | DMERR(" New layout: %s w/ %u copies", | ||
2122 | raid10_md_layout_to_format(mddev->new_layout), | ||
2123 | raid10_md_layout_to_copies(mddev->new_layout)); | ||
2124 | } | ||
2115 | return -EINVAL; | 2125 | return -EINVAL; |
2116 | } | 2126 | } |
2117 | 2127 | ||
2118 | DMINFO("Discovered old metadata format; upgrading to extended metadata format"); | 2128 | DMINFO("Discovered old metadata format; upgrading to extended metadata format"); |
2119 | |||
2120 | /* Table line is checked vs. authoritative superblock */ | ||
2121 | rs_set_new(rs); | ||
2122 | } | 2129 | } |
2123 | 2130 | ||
2124 | if (!test_bit(__CTR_FLAG_NOSYNC, &rs->ctr_flags)) | 2131 | if (!test_bit(__CTR_FLAG_NOSYNC, &rs->ctr_flags)) |
@@ -2211,7 +2218,7 @@ static int super_init_validation(struct raid_set *rs, struct md_rdev *rdev) | |||
2211 | continue; | 2218 | continue; |
2212 | 2219 | ||
2213 | if (role != r->raid_disk) { | 2220 | if (role != r->raid_disk) { |
2214 | if (__is_raid10_near(mddev->layout)) { | 2221 | if (rs_is_raid10(rs) && __is_raid10_near(mddev->layout)) { |
2215 | if (mddev->raid_disks % __raid10_near_copies(mddev->layout) || | 2222 | if (mddev->raid_disks % __raid10_near_copies(mddev->layout) || |
2216 | rs->raid_disks % rs->raid10_copies) { | 2223 | rs->raid_disks % rs->raid10_copies) { |
2217 | rs->ti->error = | 2224 | rs->ti->error = |