diff mbox

ibmvfc: Avoid unnecessary port relogin

Message ID cfbad3aa-d7d9-8fd6-0dc9-dbb0ce1f5312@linux.vnet.ibm.com (mailing list archive)
State Accepted
Headers show

Commit Message

Brian King March 14, 2018, 10:13 p.m. UTC
Following an RSCN, ibmvfc will issue an ADISC to determine
if the underlying target has changed, comparing the
SCSI ID, WWPN, and WWNN to determine how to handle the
rport in discovery. However, the comparison of the WWPN
and WWNN was performing a memcmp between a big endian
field against a CPU endian field, which resulted in
the wrong answer on LE systems. This was observed as unexpected
errors getting logged at boot time as targets were getting
relogins when not needed.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---

Comments

Martin K. Petersen March 15, 2018, 4:53 a.m. UTC | #1
Brian,

> Following an RSCN, ibmvfc will issue an ADISC to determine if the
> underlying target has changed, comparing the SCSI ID, WWPN, and WWNN
> to determine how to handle the rport in discovery. However, the
> comparison of the WWPN and WWNN was performing a memcmp between a big
> endian field against a CPU endian field, which resulted in the wrong
> answer on LE systems. This was observed as unexpected errors getting
> logged at boot time as targets were getting relogins when not needed.

Applied to 4.16/scsi-fixes, thank you!
diff mbox

Patch

Index: linux.git/drivers/scsi/ibmvscsi/ibmvfc.c
===================================================================
--- linux.git.orig/drivers/scsi/ibmvscsi/ibmvfc.c
+++ linux.git/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -3579,11 +3579,9 @@  static void ibmvfc_tgt_implicit_logout(s
 static int ibmvfc_adisc_needs_plogi(struct ibmvfc_passthru_mad *mad,
 				    struct ibmvfc_target *tgt)
 {
-	if (memcmp(&mad->fc_iu.response[2], &tgt->ids.port_name,
-		   sizeof(tgt->ids.port_name)))
+	if (wwn_to_u64((u8 *)&mad->fc_iu.response[2]) != tgt->ids.port_name)
 		return 1;
-	if (memcmp(&mad->fc_iu.response[4], &tgt->ids.node_name,
-		   sizeof(tgt->ids.node_name)))
+	if (wwn_to_u64((u8 *)&mad->fc_iu.response[4]) != tgt->ids.node_name)
 		return 1;
 	if (be32_to_cpu(mad->fc_iu.response[6]) != tgt->scsi_id)
 		return 1;