Skip to contentSkip to conversation

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

PATCH Applied Chris Leech 4 participants 6 messages Oct 21, 2016 – Oct 27, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/scsi/libfc/fc_exch.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/scsi/libfc/fc_exch.c +3 -0
index 16ca31a..42cc403 100644
@@ -910,6 +910,9 @@ static struct fc_exch *fc_exch_find(struct fc_exch_mgr *mp, u16 xid)
 	struct fc_exch *ep = NULL;
 	u16 cpu = xid & fc_cpu_mask;
 
+	if (xid == FC_XID_UNKNOWN)
+		return NULL;
+
 	if (cpu >= nr_cpu_ids || !cpu_possible(cpu)) {
 		printk_ratelimited(KERN_ERR
 			"libfc: lookup request for XID = %d, "
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Chris Leech

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.

---
 drivers/scsi/libfc/fc_exch.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/scsi/libfc/fc_exch.c +0 -0
index 16ca31a..42cc403 100644

drivers/scsi/libfc/fc_exch.c static struct fc_exch *fc_exch_find(struct fc_exch_mgr *mp, u16 xid) · line 918

Quoted 9 lines
drivers/scsi/libfc/fc_exch.c +3 -0
@@ -910,6 +910,9 @@ static struct fc_exch *fc_exch_find(struct fc_exch_mgr *mp, u16 xid)
 	struct fc_exch *ep = NULL;
 	u16 cpu = xid & fc_cpu_mask;
 
+	if (xid == FC_XID_UNKNOWN)
+		return NULL;
+
 	if (cpu >= nr_cpu_ids || !cpu_possible(cpu)) {
 		printk_ratelimited(KERN_ERR
 			"libfc: lookup request for XID = %d, "
maintainer
#2 lore raw
In reply to Chris Leech
Quoted 21 lines · Chris Leech

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.

---
 drivers/scsi/libfc/fc_exch.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/scsi/libfc/fc_exch.c +0 -0
index 16ca31a..42cc403 100644

drivers/scsi/libfc/fc_exch.c static struct fc_exch *fc_exch_find(struct fc_exch_mgr *mp, u16 xid) · line 918

Quoted 9 lines
drivers/scsi/libfc/fc_exch.c +3 -0
@@ -910,6 +910,9 @@ static struct fc_exch *fc_exch_find(struct fc_exch_mgr *mp, u16 xid)
 	struct fc_exch *ep = NULL;
 	u16 cpu = xid & fc_cpu_mask;
 
+	if (xid == FC_XID_UNKNOWN)
+		return NULL;
+
 	if (cpu >= nr_cpu_ids || !cpu_possible(cpu)) {
 		printk_ratelimited(KERN_ERR
 			"libfc: lookup request for XID = %d, "

Does that still apply with my libfc patchset? I was under the impression I've fixed it already ...

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#3 lore raw
Quoted 24 lines · Hannes Reinecke
Quoted 23 lines · Chris Leech

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.

---
drivers/scsi/libfc/fc_exch.c | 3 +++

1 file changed, 3 insertions(+)
drivers/scsi/libfc/fc_exch.c +0 -0
index 16ca31a..42cc403 100644
@@ -910,6 +910,9 @@ static struct fc_exch *fc_exch_find(struct fc_exch_mgr *mp, u16 xid)
 	struct fc_exch *ep = NULL;
 	u16 cpu = xid & fc_cpu_mask;
 
Quoted 9 lines

drivers/scsi/libfc/fc_exch.c static struct fc_exch *fc_exch_find(struct fc_exch_mgr *mp, u16 xid) · line 918

Quoted 7 lines
drivers/scsi/libfc/fc_exch.c +3 -0
+	if (xid == FC_XID_UNKNOWN)
+		return NULL;
+
 	if (cpu >= nr_cpu_ids || !cpu_possible(cpu)) {
 		printk_ratelimited(KERN_ERR
 			"libfc: lookup request for XID = %d, "

Does that still apply with my libfc patchset? I was under the impression I've fixed it already ...

I believe so, although it might need refreshing to fix up the context change.

It looks like you made a change specifically for REC, but in target mode with tcm_fc the first frame every new exchange comes in with RX_ID unknown until we assign one.

Chris

maintainer Reviewed-by
#4 lore raw
Quoted 35 lines · Chris Leech
Quoted 24 lines · Hannes Reinecke
Quoted 23 lines · Chris Leech

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.

---
drivers/scsi/libfc/fc_exch.c | 3 +++

1 file changed, 3 insertions(+)
drivers/scsi/libfc/fc_exch.c +0 -0
index 16ca31a..42cc403 100644
@@ -910,6 +910,9 @@ static struct fc_exch *fc_exch_find(struct fc_exch_mgr *mp, u16 xid)
 	struct fc_exch *ep = NULL;
 	u16 cpu = xid & fc_cpu_mask;
 
Quoted 9 lines

drivers/scsi/libfc/fc_exch.c static struct fc_exch *fc_exch_find(struct fc_exch_mgr *mp, u16 xid) · line 918

Quoted 7 lines
drivers/scsi/libfc/fc_exch.c +3 -0
+	if (xid == FC_XID_UNKNOWN)
+		return NULL;
+
 	if (cpu >= nr_cpu_ids || !cpu_possible(cpu)) {
 		printk_ratelimited(KERN_ERR
 			"libfc: lookup request for XID = %d, "

Does that still apply with my libfc patchset? I was under the impression I've fixed it already ...

Quoted 7 lines

I believe so, although it might need refreshing to fix up the context change.

It looks like you made a change specifically for REC, but in target mode with tcm_fc the first frame every new exchange comes in with RX_ID unknown until we assign one.

Indeed; looks you're right.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#5 lore raw
In reply to Chris Leech
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Chris" == Chris Leech <[email protected]> writes:

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

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

Applied to 4.10/scsi-queue by hand as a result of all the libfc changes. Please verify.

Thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering