All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] libfc: don't have fc_exch_find log errors on a new exchange
@ 2016-10-21 21:10 Chris Leech
  2016-10-24 13:35 ` Ewan D. Milne
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chris Leech @ 2016-10-21 21:10 UTC (permalink / raw)
  To: linux-scsi

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.

Signed-off-by: Chris Leech <cleech@redhat.com>
---
 drivers/scsi/libfc/fc_exch.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 16ca31a..42cc403 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -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, "
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] libfc: don't have fc_exch_find log errors on a new exchange
  2016-10-21 21:10 [PATCH 1/1] libfc: don't have fc_exch_find log errors on a new exchange Chris Leech
@ 2016-10-24 13:35 ` Ewan D. Milne
  2016-10-24 14:37 ` Hannes Reinecke
  2016-10-27  1:41 ` Martin K. Petersen
  2 siblings, 0 replies; 6+ messages in thread
From: Ewan D. Milne @ 2016-10-24 13:35 UTC (permalink / raw)
  To: Chris Leech; +Cc: linux-scsi

On Fri, 2016-10-21 at 14:10 -0700, Chris Leech wrote:
> 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.
> 
> Signed-off-by: Chris Leech <cleech@redhat.com>
> ---
>  drivers/scsi/libfc/fc_exch.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
> index 16ca31a..42cc403 100644
> --- a/drivers/scsi/libfc/fc_exch.c
> +++ b/drivers/scsi/libfc/fc_exch.c
> @@ -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, "

Reviewed-by: Ewan D. Milne <emilne@redhat.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] libfc: don't have fc_exch_find log errors on a new exchange
  2016-10-21 21:10 [PATCH 1/1] libfc: don't have fc_exch_find log errors on a new exchange Chris Leech
  2016-10-24 13:35 ` Ewan D. Milne
@ 2016-10-24 14:37 ` Hannes Reinecke
  2016-10-25 17:51   ` Chris Leech
  2016-10-27  1:41 ` Martin K. Petersen
  2 siblings, 1 reply; 6+ messages in thread
From: Hannes Reinecke @ 2016-10-24 14:37 UTC (permalink / raw)
  To: Chris Leech, linux-scsi

On 10/21/2016 11:10 PM, Chris Leech wrote:
> 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.
>
> Signed-off-by: Chris Leech <cleech@redhat.com>
> ---
>  drivers/scsi/libfc/fc_exch.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
> index 16ca31a..42cc403 100644
> --- a/drivers/scsi/libfc/fc_exch.c
> +++ b/drivers/scsi/libfc/fc_exch.c
> @@ -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
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +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)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] libfc: don't have fc_exch_find log errors on a new exchange
  2016-10-24 14:37 ` Hannes Reinecke
@ 2016-10-25 17:51   ` Chris Leech
  2016-10-26  5:48     ` Hannes Reinecke
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Leech @ 2016-10-25 17:51 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-scsi

On Mon, Oct 24, 2016 at 04:37:59PM +0200, Hannes Reinecke wrote:
> On 10/21/2016 11:10 PM, Chris Leech wrote:
> >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.
> >
> >Signed-off-by: Chris Leech <cleech@redhat.com>
> >---
> > drivers/scsi/libfc/fc_exch.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> >diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
> >index 16ca31a..42cc403 100644
> >--- a/drivers/scsi/libfc/fc_exch.c
> >+++ b/drivers/scsi/libfc/fc_exch.c
> >@@ -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 ...

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] libfc: don't have fc_exch_find log errors on a new exchange
  2016-10-25 17:51   ` Chris Leech
@ 2016-10-26  5:48     ` Hannes Reinecke
  0 siblings, 0 replies; 6+ messages in thread
From: Hannes Reinecke @ 2016-10-26  5:48 UTC (permalink / raw)
  To: Chris Leech, linux-scsi

On 10/25/2016 07:51 PM, Chris Leech wrote:
> On Mon, Oct 24, 2016 at 04:37:59PM +0200, Hannes Reinecke wrote:
>> On 10/21/2016 11:10 PM, Chris Leech wrote:
>>> 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.
>>>
>>> Signed-off-by: Chris Leech <cleech@redhat.com>
>>> ---
>>> drivers/scsi/libfc/fc_exch.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
>>> index 16ca31a..42cc403 100644
>>> --- a/drivers/scsi/libfc/fc_exch.c
>>> +++ b/drivers/scsi/libfc/fc_exch.c
>>> @@ -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 ...
> 
> 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.

Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +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)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] libfc: don't have fc_exch_find log errors on a new exchange
  2016-10-21 21:10 [PATCH 1/1] libfc: don't have fc_exch_find log errors on a new exchange Chris Leech
  2016-10-24 13:35 ` Ewan D. Milne
  2016-10-24 14:37 ` Hannes Reinecke
@ 2016-10-27  1:41 ` Martin K. Petersen
  2 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2016-10-27  1:41 UTC (permalink / raw)
  To: Chris Leech; +Cc: linux-scsi

>>>>> "Chris" == Chris Leech <cleech@redhat.com> 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!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-10-27  1:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-21 21:10 [PATCH 1/1] libfc: don't have fc_exch_find log errors on a new exchange Chris Leech
2016-10-24 13:35 ` Ewan D. Milne
2016-10-24 14:37 ` Hannes Reinecke
2016-10-25 17:51   ` Chris Leech
2016-10-26  5:48     ` Hannes Reinecke
2016-10-27  1:41 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.