Commit e31e1812 authored by Xiang Chen's avatar Xiang Chen Committed by Martin K. Petersen
Browse files

scsi: libsas: Insert PORTE_BROADCAST_RCVD event for resuming host

If a new disk is inserted through an expander when the host was suspended,
it will not necessarily be detected as the topology is not re-scanned
during resume.  To detect possible changes in topology during suspension,
insert a PORTE_BROADCAST_RCVD event per port when resuming to trigger a
revalidation.

Link: https://lore.kernel.org/r/1639999298-244569-8-git-send-email-chenxiang66@hisilicon.com


Reviewed-by: default avatarJohn Garry <john.garry@huawei.com>
Signed-off-by: default avatarXiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 133b688b
Loading
Loading
Loading
Loading
+29 −0
Original line number Original line Diff line number Diff line
@@ -387,6 +387,30 @@ static int phys_suspended(struct sas_ha_struct *ha)
	return rc;
	return rc;
}
}


static void sas_resume_insert_broadcast_ha(struct sas_ha_struct *ha)
{
	int i;

	for (i = 0; i < ha->num_phys; i++) {
		struct asd_sas_port *port = ha->sas_port[i];
		struct domain_device *dev = port->port_dev;

		if (dev && dev_is_expander(dev->dev_type)) {
			struct asd_sas_phy *first_phy;

			spin_lock(&port->phy_list_lock);
			first_phy = list_first_entry_or_null(
				&port->phy_list, struct asd_sas_phy,
				port_phy_el);
			spin_unlock(&port->phy_list_lock);

			if (first_phy)
				sas_notify_port_event(first_phy,
					PORTE_BROADCAST_RCVD, GFP_KERNEL);
		}
	}
}

static void _sas_resume_ha(struct sas_ha_struct *ha, bool drain)
static void _sas_resume_ha(struct sas_ha_struct *ha, bool drain)
{
{
	const unsigned long tmo = msecs_to_jiffies(25000);
	const unsigned long tmo = msecs_to_jiffies(25000);
@@ -419,6 +443,11 @@ static void _sas_resume_ha(struct sas_ha_struct *ha, bool drain)
	scsi_unblock_requests(ha->core.shost);
	scsi_unblock_requests(ha->core.shost);
	if (drain)
	if (drain)
		sas_drain_work(ha);
		sas_drain_work(ha);

	/* send event PORTE_BROADCAST_RCVD to identify some new inserted
	 * disks for expander
	 */
	sas_resume_insert_broadcast_ha(ha);
}
}


void sas_resume_ha(struct sas_ha_struct *ha)
void sas_resume_ha(struct sas_ha_struct *ha)