mirror of
git://sourceware.org/git/lvm2.git
synced 2025-10-23 23:33:15 +03:00
raid: adjust to misordered raid table line output
The libdevmapper interface compares existing table line retrieved from the kernel to new table line created to decide if it can suppress a reload. Any difference between input and output of the table line is taken to be a change thus causing a table reload. The dm-raid target started to misorder the raid parameters (e.g. 'raid10_copies') starting with dm-raid target version 1.9.0 up to (excluding) 1.11.0. This causes runtime failures (limited to raid10 as of tests) and needs to be reversed to allow e.g. old lvm2 uspace to run properly. Check for the aforementioned version range and adjust creation of the table line to the respective (mis)ordered sequence inside and correct order outside the range (as described for the raid target in the kernels Documentation/device-mapper/dm-raid.txt).
This commit is contained in:
@@ -228,6 +228,9 @@ static int _raid_text_export(const struct lv_segment *seg, struct formatter *f)
|
||||
return _raid_text_export_raid(seg, f);
|
||||
}
|
||||
|
||||
static int _raid_target_present(struct cmd_context *cmd,
|
||||
const struct lv_segment *seg __attribute__((unused)),
|
||||
unsigned *attributes);
|
||||
static int _raid_add_target_line(struct dev_manager *dm __attribute__((unused)),
|
||||
struct dm_pool *mem __attribute__((unused)),
|
||||
struct cmd_context *cmd __attribute__((unused)),
|
||||
@@ -238,6 +241,7 @@ static int _raid_add_target_line(struct dev_manager *dm __attribute__((unused)),
|
||||
uint32_t *pvmove_mirror_count __attribute__((unused)))
|
||||
{
|
||||
int delta_disks = 0, delta_disks_minus = 0, delta_disks_plus = 0, data_offset = 0;
|
||||
unsigned attrs;
|
||||
uint32_t s;
|
||||
uint64_t flags = 0;
|
||||
uint64_t rebuilds[RAID_BITMAP_SIZE];
|
||||
@@ -300,6 +304,13 @@ static int _raid_add_target_line(struct dev_manager *dm __attribute__((unused)),
|
||||
flags = DM_NOSYNC;
|
||||
}
|
||||
|
||||
if (!_raid_target_present(seg->lv->vg->cmd, seg, &attrs))
|
||||
return_0;
|
||||
|
||||
/* RAID target line parameters are in kernel documented order */
|
||||
if (attrs & RAID_FEATURE_PROPER_TABLE_ORDER)
|
||||
flags |= DM_RAID_TABLE_ORDERED;
|
||||
|
||||
params.raid_type = lvseg_name(seg);
|
||||
|
||||
if (seg->segtype->parity_devs) {
|
||||
@@ -479,7 +490,7 @@ static int _raid_target_present(struct cmd_context *cmd,
|
||||
|
||||
static int _raid_checked = 0;
|
||||
static int _raid_present = 0;
|
||||
static unsigned _raid_attrs = 0;
|
||||
static unsigned _raid_attrs;
|
||||
uint32_t maj, min, patchlevel;
|
||||
unsigned i;
|
||||
|
||||
@@ -488,6 +499,7 @@ static int _raid_target_present(struct cmd_context *cmd,
|
||||
|
||||
if (!_raid_checked) {
|
||||
_raid_checked = 1;
|
||||
_raid_attrs = RAID_FEATURE_PROPER_TABLE_ORDER;
|
||||
|
||||
if (!(_raid_present = target_present(cmd, TARGET_NAME_RAID, 1)))
|
||||
return 0;
|
||||
@@ -514,6 +526,15 @@ static int _raid_target_present(struct cmd_context *cmd,
|
||||
else
|
||||
log_very_verbose("Target raid does not support %s.",
|
||||
SEG_TYPE_NAME_RAID4);
|
||||
|
||||
/*
|
||||
* Target version range check:
|
||||
*
|
||||
* raid target line parameters were misordered (e.g. 'raid10_copies')
|
||||
* in target version >= 1.9.0 and < 1.11.0
|
||||
*/
|
||||
if (maj == 1 && min >= 9 && min < 11)
|
||||
_raid_attrs &= ~RAID_FEATURE_PROPER_TABLE_ORDER;
|
||||
}
|
||||
|
||||
if (attributes)
|
||||
|
||||
Reference in New Issue
Block a user