All of lore.kernel.org
 help / color / mirror / Atom feed
* [lustre-devel] [PATCH] staging: lustre: lnet: use correct 'magic' test
@ 2018-03-21 19:53 Justin Skists
  2018-03-21 23:40 ` NeilBrown
  2018-03-23  5:54 ` Doug Oucharek
  0 siblings, 2 replies; 3+ messages in thread
From: Justin Skists @ 2018-03-21 19:53 UTC (permalink / raw)
  To: lustre-devel

Use the lnet_magic_accept() function to compare 'magic' against
LNET_PROTO_TCP_MAGIC for the appropriate string for an error message.

The original fix removed an unneeded byte-ordering cast because the define
was already CPU byte-ordered and it was assumed that 'magic' was CPU
byte-ordered, too.

Now modify the if-statement to use the appropriate lnet_accept_magic()
function in order to be consistent with similar tests. This will allow
the code to be consistent with the general understanding that 'magic'
should be in host-byte-order for the peer that sent the message.

Fixes: 80782927e3aa ("staging: lustre: Fix unneeded byte-ordering cast")
Cc: NeilBrown <neilb@suse.com>
Signed-off-by: Justin Skists <j.skists@gmail.com>
---
 drivers/staging/lustre/lnet/lnet/acceptor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c
index 13e981781b9a..5648f17eddc0 100644
--- a/drivers/staging/lustre/lnet/lnet/acceptor.c
+++ b/drivers/staging/lustre/lnet/lnet/acceptor.c
@@ -240,7 +240,7 @@ lnet_accept(struct socket *sock, __u32 magic)
 			return -EPROTO;
 		}
 
-		if (magic == LNET_PROTO_TCP_MAGIC)
+		if (lnet_accept_magic(magic, LNET_PROTO_TCP_MAGIC))
 			str = "'old' socknal/tcpnal";
 		else
 			str = "unrecognised";
-- 
2.16.2

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

* [lustre-devel] [PATCH] staging: lustre: lnet: use correct 'magic' test
  2018-03-21 19:53 [lustre-devel] [PATCH] staging: lustre: lnet: use correct 'magic' test Justin Skists
@ 2018-03-21 23:40 ` NeilBrown
  2018-03-23  5:54 ` Doug Oucharek
  1 sibling, 0 replies; 3+ messages in thread
From: NeilBrown @ 2018-03-21 23:40 UTC (permalink / raw)
  To: lustre-devel

On Wed, Mar 21 2018, Justin Skists wrote:

> Use the lnet_magic_accept() function to compare 'magic' against
> LNET_PROTO_TCP_MAGIC for the appropriate string for an error message.
>
> The original fix removed an unneeded byte-ordering cast because the define
> was already CPU byte-ordered and it was assumed that 'magic' was CPU
> byte-ordered, too.
>
> Now modify the if-statement to use the appropriate lnet_accept_magic()
> function in order to be consistent with similar tests. This will allow
> the code to be consistent with the general understanding that 'magic'
> should be in host-byte-order for the peer that sent the message.
>
> Fixes: 80782927e3aa ("staging: lustre: Fix unneeded byte-ordering cast")
> Cc: NeilBrown <neilb@suse.com>

Reviewed-by: NeilBrown <neilb@suse.com>

thanks,
NeilBrown

> Signed-off-by: Justin Skists <j.skists@gmail.com>
> ---
>  drivers/staging/lustre/lnet/lnet/acceptor.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c
> index 13e981781b9a..5648f17eddc0 100644
> --- a/drivers/staging/lustre/lnet/lnet/acceptor.c
> +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c
> @@ -240,7 +240,7 @@ lnet_accept(struct socket *sock, __u32 magic)
>  			return -EPROTO;
>  		}
>  
> -		if (magic == LNET_PROTO_TCP_MAGIC)
> +		if (lnet_accept_magic(magic, LNET_PROTO_TCP_MAGIC))
>  			str = "'old' socknal/tcpnal";
>  		else
>  			str = "unrecognised";
> -- 
> 2.16.2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180322/cc5a0967/attachment.sig>

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

* [lustre-devel] [PATCH] staging: lustre: lnet: use correct 'magic' test
  2018-03-21 19:53 [lustre-devel] [PATCH] staging: lustre: lnet: use correct 'magic' test Justin Skists
  2018-03-21 23:40 ` NeilBrown
@ 2018-03-23  5:54 ` Doug Oucharek
  1 sibling, 0 replies; 3+ messages in thread
From: Doug Oucharek @ 2018-03-23  5:54 UTC (permalink / raw)
  To: lustre-devel


On Mar 21, 2018, at 12:53 PM, Justin Skists <j.skists at gmail.com<mailto:j.skists@gmail.com>> wrote:

Use the lnet_magic_accept() function to compare 'magic' against
LNET_PROTO_TCP_MAGIC for the appropriate string for an error message.

The original fix removed an unneeded byte-ordering cast because the define
was already CPU byte-ordered and it was assumed that 'magic' was CPU
byte-ordered, too.

Now modify the if-statement to use the appropriate lnet_accept_magic()
function in order to be consistent with similar tests. This will allow
the code to be consistent with the general understanding that 'magic'
should be in host-byte-order for the peer that sent the message.

Fixes: 80782927e3aa ("staging: lustre: Fix unneeded byte-ordering cast")
Cc: NeilBrown <neilb at suse.com<mailto:neilb@suse.com>>
Signed-off-by: Justin Skists <j.skists at gmail.com<mailto:j.skists@gmail.com>>
---
drivers/staging/lustre/lnet/lnet/acceptor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c
index 13e981781b9a..5648f17eddc0 100644
--- a/drivers/staging/lustre/lnet/lnet/acceptor.c
+++ b/drivers/staging/lustre/lnet/lnet/acceptor.c
@@ -240,7 +240,7 @@ lnet_accept(struct socket *sock, __u32 magic)
return -EPROTO;
}

- if (magic == LNET_PROTO_TCP_MAGIC)
+ if (lnet_accept_magic(magic, LNET_PROTO_TCP_MAGIC))
str = "'old' socknal/tcpnal";
else
str = "unrecognised";
--
2.16.2

Reviewed by: Doug Oucharek <dougso at me.com<mailto:dougso@me.com>>



_______________________________________________
lustre-devel mailing list
lustre-devel at lists.lustre.org<mailto:lustre-devel@lists.lustre.org>
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180323/d2263fa1/attachment.html>

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

end of thread, other threads:[~2018-03-23  5:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-21 19:53 [lustre-devel] [PATCH] staging: lustre: lnet: use correct 'magic' test Justin Skists
2018-03-21 23:40 ` NeilBrown
2018-03-23  5:54 ` Doug Oucharek

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.