Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Nov 2017 17:07:21 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r326323 - stable/11/sys/dev/mpr
Message-ID:  <201711281707.vASH7Lxq078764@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Tue Nov 28 17:07:21 2017
New Revision: 326323
URL: https://svnweb.freebsd.org/changeset/base/326323

Log:
  MFC r325363:
  
  Fix mpr(4) panics caused by bad drive mapping tables
  
  sys/dev/mpr/mpr_mapping.c
  	If _mapping_process_dpm_pg0 detects inconsistencies in the drive
  	mapping table (stored in the HBA's NVRAM), abort reading it and
  	continue to boot as if the mapping table were blank.  I observed
  	such inconsistencies in several HBAs after upgrading firmware from
  	14.0.0.0 to 15.0.0.0.
  
  Reviewed by:	slm
  Sponsored by:	Spectra Logic Corp
  Differential Revision:	https://reviews.freebsd.org/D12901

Modified:
  stable/11/sys/dev/mpr/mpr_mapping.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mpr/mpr_mapping.c
==============================================================================
--- stable/11/sys/dev/mpr/mpr_mapping.c	Tue Nov 28 17:04:22 2017	(r326322)
+++ stable/11/sys/dev/mpr/mpr_mapping.c	Tue Nov 28 17:07:21 2017	(r326323)
@@ -2210,7 +2210,7 @@ mpr_mapping_free_memory(struct mpr_softc *sc)
 	free(sc->dpm_pg0, M_MPR);
 }
 
-static void
+static bool
 _mapping_process_dpm_pg0(struct mpr_softc *sc)
 {
 	u8 missing_cnt, enc_idx;
@@ -2339,7 +2339,7 @@ _mapping_process_dpm_pg0(struct mpr_softc *sc)
 					    "%s: Conflict in mapping table for "
 					    " enclosure %d\n", __func__,
 					    enc_idx);
-					break;
+					goto fail;
 				}
 				physical_id =
 				    dpm_entry->PhysicalIdentifier.High;
@@ -2366,7 +2366,7 @@ _mapping_process_dpm_pg0(struct mpr_softc *sc)
 				mpr_dprint(sc, MPR_ERROR | MPR_MAPPING, "%s: "
 				    "Conflict in mapping table for device %d\n",
 				    __func__, map_idx);
-				break;
+				goto fail;
 			}
 			physical_id = dpm_entry->PhysicalIdentifier.High;
 			mt_entry->physical_id = (physical_id << 32) |
@@ -2378,6 +2378,18 @@ _mapping_process_dpm_pg0(struct mpr_softc *sc)
 			mt_entry->device_info = MPR_DEV_RESERVED;
 		}
 	} /*close the loop for DPM table */
+	return (true);
+
+fail:
+	for (entry_num = 0; entry_num < sc->max_dpm_entries; entry_num++) {
+		sc->dpm_entry_used[entry_num] = 0;
+		/*
+		 * for IR firmware, it may be necessary to wipe out
+		 * sc->mapping_table volumes tooi
+		 */
+	}
+	sc->num_enc_table_entries = 0;
+	return (false);
 }
 
 /*
@@ -2617,9 +2629,11 @@ retry_read_dpm:
 		}
 	}
 
-	if (sc->is_dpm_enable)
-		_mapping_process_dpm_pg0(sc);
-	else {
+	if (sc->is_dpm_enable) {
+		if (!_mapping_process_dpm_pg0(sc))
+			sc->is_dpm_enable = 0;
+	}
+	if (! sc->is_dpm_enable) {
 		mpr_dprint(sc, MPR_MAPPING, "%s: DPM processing is disabled. "
 		    "Device mappings will not persist across reboots or "
 		    "resets.\n", __func__);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711281707.vASH7Lxq078764>