summaryrefslogtreecommitdiff
path: root/super-intel.c
diff options
context:
space:
mode:
authorPawel Baldysiak <pawel.baldysiak@intel.com>2014-06-30 12:22:22 +0000
committerNeilBrown <neilb@suse.de>2014-07-08 11:39:23 +1000
commit0c21b485e4beb7bcfe631412a231f7c1ea1067bc (patch)
treee823b8b5ad90ac368616e065cd7b73fc4f046daa /super-intel.c
parent120ec6f7b96455e42bdfa9131c0c9026c57eaf19 (diff)
IMSM: Add warning message when assemble spanned container
Due to several changes in code assemble with disks spanned between different controllers can be obtained in some cases. After IMSM container will be assembled, check HBA of disks, and print proper warning if mismatch is detected. Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super-intel.c')
-rw-r--r--super-intel.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/super-intel.c b/super-intel.c
index 0106b4f6..7734bde4 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -10484,6 +10484,48 @@ abort:
return ret_val;
}
+
+/*******************************************************************************
+ * Function: validate_container_imsm
+ * Description: This routine validates container after assemble,
+ * eg. if devices in container are under the same controller.
+ *
+ * Parameters:
+ * info : linked list with info about devices used in array
+ * Returns:
+ * 1 : HBA mismatch
+ * 0 : Success
+ ******************************************************************************/
+int validate_container_imsm(struct mdinfo *info)
+{
+ if (!check_env("IMSM_NO_PLATFORM")) {
+ struct sys_dev *idev;
+ struct mdinfo *dev;
+ char *hba_path = NULL;
+ char *dev_path = devt_to_devpath(makedev(info->disk.major,
+ info->disk.minor));
+
+ for (idev = find_intel_devices(); idev; idev = idev->next) {
+ if (strstr(dev_path, idev->path)) {
+ hba_path = idev->path;
+ break;
+ }
+ }
+ free(dev_path);
+
+ if (hba_path) {
+ for (dev = info->next; dev; dev = dev->next) {
+ if (!devt_attached_to_hba(makedev(dev->disk.major,
+ dev->disk.minor), hba_path)) {
+ pr_err("WARNING - IMSM container assembled with disks under different HBAs!\n"
+ " This operation is not supported and can lead to data loss.\n");
+ return 1;
+ }
+ }
+ }
+ }
+ return 0;
+}
#endif /* MDASSEMBLE */
struct superswitch super_imsm = {
@@ -10527,6 +10569,7 @@ struct superswitch super_imsm = {
.free_super = free_super_imsm,
.match_metadata_desc = match_metadata_desc_imsm,
.container_content = container_content_imsm,
+ .validate_container = validate_container_imsm,
.external = 1,
.name = "imsm",