|
|
2c1b57 |
commit f2cc4f7d829e1b849e78bdf6c38b7bd6e234c600
|
|
|
2c1b57 |
Author: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
|
|
|
2c1b57 |
Date: Tue May 9 12:25:45 2017 +0200
|
|
|
2c1b57 |
|
|
|
2c1b57 |
imsm: don't allow disks with different sector size in one array
|
|
|
2c1b57 |
|
|
|
2c1b57 |
As there is no support in IMSM for arrays including disks with different
|
|
|
2c1b57 |
sector sizes, don't allow to create such configuration. Also skip the
|
|
|
2c1b57 |
disk with unsuitable sector size when looking for spares in the same
|
|
|
2c1b57 |
container.
|
|
|
2c1b57 |
|
|
|
2c1b57 |
Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
|
|
|
2c1b57 |
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
|
|
|
2c1b57 |
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
|
2c1b57 |
|
|
|
2c1b57 |
diff --git a/super-intel.c b/super-intel.c
|
|
|
2c1b57 |
index cfb10d5..e88fe82 100644
|
|
|
2c1b57 |
--- a/super-intel.c
|
|
|
2c1b57 |
+++ b/super-intel.c
|
|
|
2c1b57 |
@@ -5468,6 +5468,22 @@ static int init_super_imsm(struct supertype *st, mdu_array_info_t *info,
|
|
|
2c1b57 |
return 1;
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
|
|
|
2c1b57 |
+static int drive_validate_sector_size(struct intel_super *super, struct dl *dl)
|
|
|
2c1b57 |
+{
|
|
|
2c1b57 |
+ unsigned int member_sector_size;
|
|
|
2c1b57 |
+
|
|
|
2c1b57 |
+ if (dl->fd < 0) {
|
|
|
2c1b57 |
+ pr_err("Invalid file descriptor for %s\n", dl->devname);
|
|
|
2c1b57 |
+ return 0;
|
|
|
2c1b57 |
+ }
|
|
|
2c1b57 |
+
|
|
|
2c1b57 |
+ if (!get_dev_sector_size(dl->fd, dl->devname, &member_sector_size))
|
|
|
2c1b57 |
+ return 0;
|
|
|
2c1b57 |
+ if (member_sector_size != super->sector_size)
|
|
|
2c1b57 |
+ return 0;
|
|
|
2c1b57 |
+ return 1;
|
|
|
2c1b57 |
+}
|
|
|
2c1b57 |
+
|
|
|
2c1b57 |
static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk,
|
|
|
2c1b57 |
int fd, char *devname)
|
|
|
2c1b57 |
{
|
|
|
2c1b57 |
@@ -5507,6 +5523,11 @@ static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk,
|
|
|
2c1b57 |
return 1;
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
|
|
|
2c1b57 |
+ if (!drive_validate_sector_size(super, dl)) {
|
|
|
2c1b57 |
+ pr_err("Combining drives of different sector size in one volume is not allowed\n");
|
|
|
2c1b57 |
+ return 1;
|
|
|
2c1b57 |
+ }
|
|
|
2c1b57 |
+
|
|
|
2c1b57 |
/* add a pristine spare to the metadata */
|
|
|
2c1b57 |
if (dl->index < 0) {
|
|
|
2c1b57 |
dl->index = super->anchor->num_disks;
|
|
|
2c1b57 |
@@ -8440,6 +8461,9 @@ static struct dl *imsm_add_spare(struct intel_super *super, int slot,
|
|
|
2c1b57 |
if (dl->index == -1 && !activate_new)
|
|
|
2c1b57 |
continue;
|
|
|
2c1b57 |
|
|
|
2c1b57 |
+ if (!drive_validate_sector_size(super, dl))
|
|
|
2c1b57 |
+ continue;
|
|
|
2c1b57 |
+
|
|
|
2c1b57 |
/* Does this unused device have the requisite free space?
|
|
|
2c1b57 |
* It needs to be able to cover all member volumes
|
|
|
2c1b57 |
*/
|