Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: libfc: Don't have fc_exch_find log errors on a new exchange

With the error message I added in "libfc: sanity check cpu number
extracted from xid" I didn't account for the fact that fc_exch_find is
called with FC_XID_UNKNOWN at the start of a new exchange if we are the
responder.

It doesn't come up with the initiator much, but that's basically every
exchange for a target. By checking the xid for FC_XID_UNKNOWN first, we
not only prevent the erroneous error message, but skip the unnecessary
lookup attempt as well.

[mkp: applied by hand due to conflict with Hannes' libfc patch series]

Signed-off-by: Chris Leech <cleech@redhat.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Chris Leech and committed by
Martin K. Petersen
d5c3eb26 3f0c06de

+3
+3
drivers/scsi/libfc/fc_exch.c
··· 939 939 struct fc_exch *ep = NULL; 940 940 u16 cpu = xid & fc_cpu_mask; 941 941 942 + if (xid == FC_XID_UNKNOWN) 943 + return NULL; 944 + 942 945 if (cpu >= nr_cpu_ids || !cpu_possible(cpu)) { 943 946 pr_err("host%u: lport %6.6x: xid %d invalid CPU %d\n:", 944 947 lport->host->host_no, lport->port_id, xid, cpu);