Skip to contentSkip to conversation

mpt3sas: Fix system falling into readonly mode

PATCH Applied Sreekanth Reddy 2 participants 2 messages Nov 17, 2021 – Nov 19, 2021

Subsystems (2)
lore
Share & tools
lore

Sreekanth Reddy

author maintainer
#0 lore raw

PATCH 1/1 mpt3sas: Fix system falling into readonly mode

While determining the SAS address of a drive, the driver checks whether the handle number is less than the HBA phys count or not.
If the handle number is less than the HBA phy’s count then driver assumes that this handle belongs to HBA and hence it assigns the HBA SAS address.
During IOC firmware downgrade operation, if the number of HBA phys got reduced and the OS drive’s device handle falls below start of the day HBA phys count then while determining the OS drive’s SAS address driver uses the HBA SAS address. This leads to a mismatch of drive’s SAS address and hence the driver unregisters the OS drive and the system falls into read only mode.

Updated the IOC's num_phys to HBA phy’s count provided by actual loaded firmware. So that while determining the SAS address driver uses updated HBA phy’s count value instead of using a start of the day’s HBA phy’s count.

Fixes a5e99fda0172("mpt3sas: Update hba_port objects after host reset")
---
 drivers/scsi/mpt3sas/mpt3sas_base.h  |  4 ++
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 57 +++++++++++++++++++++++++++-
 2 files changed, 60 insertions(+), 1 deletion(-)
drivers/scsi/mpt3sas/mpt3sas_base.h +4 -0
index db6a759de1e9..a0af986633d2 100644
@@ -142,6 +142,8 @@
 
 #define MPT_MAX_CALLBACKS		32
 
+#define MPT_MAX_HBA_NUM_PHYS		32
+
 #define INTERNAL_CMDS_COUNT		10	/* reserved cmds */
 /* reserved for issuing internally framed scsi io cmds */
 #define INTERNAL_SCSIIO_CMDS_COUNT	3
@@ -798,6 +800,7 @@ struct _sas_phy {
  * @enclosure_handle: handle for this a member of an enclosure
  * @device_info: bitwise defining capabilities of this sas_host/expander
  * @responding: used in _scsih_expander_device_mark_responding
+ * @nr_phys_allocated: Allocated memory for this many count phys
  * @phy: a list of phys that make up this sas_host/expander
  * @sas_port_list: list of ports attached to this sas_host/expander
  * @port: hba port entry containing node's port number info
@@ -813,6 +816,7 @@ struct _sas_node {
 	u16	enclosure_handle;
 	u64	enclosure_logical_id;
 	u8	responding;
+	u8	nr_phys_allocated;
 	struct hba_port *port;
 	struct	_sas_phy *phy;
 	struct list_head sas_port_list;
drivers/scsi/mpt3sas/mpt3sas_scsih.c +56 -1

86 lines not on this page · raw message

Signature · 1 line
2.27.0
#1 lore raw
Quoted 12 lines · Sreekanth Reddy

While determining the SAS address of a drive, the driver checks whether the handle number is less than the HBA phys count or not.
If the handle number is less than the HBA phy’s count then driver assumes that this handle belongs to HBA and hence it assigns the HBA SAS address.
During IOC firmware downgrade operation, if the number of HBA phys got reduced and the OS drive’s device handle falls below start of the day HBA phys count then while determining the OS drive’s SAS address driver uses the HBA SAS address. This leads to a mismatch of drive’s SAS address and hence the driver unregisters the OS drive and the system falls into read only mode.

Quoted 1 line

[...]

Applied to 5.16/scsi-fixes, thanks!

[1/1] mpt3sas: Fix system falling into readonly mode

      https://git.kernel.org/mkp/scsi/c/91202a01a2fb
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering