Skip to contentSkip to conversation

staging: lustre: lnet: use correct 'magic' test

PATCH New Justin Skists 3 participants 3 messages Mar 21, 2018 – Mar 23, 2018 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: lustre: lnet: use correct 'magic' test

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 <[email protected]>
---
 drivers/staging/lustre/lnet/lnet/acceptor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lnet/lnet/acceptor.c +1 -1
index 13e981781b9a..5648f17eddc0 100644
@@ -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";
Signature · 1 line
2.16.2
#1 lore raw

PATCH 1/1 staging: lustre: lnet: use correct 'magic' test

Quoted 7 lines · Justin Skists

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.

Quoted 7 lines

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 <[email protected]>

thanks,
NeilBrown

Quoted 20 lines
---
 drivers/staging/lustre/lnet/lnet/acceptor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lnet/lnet/acceptor.c +1 -1
index 13e981781b9a..5648f17eddc0 100644
@@ -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";
Signature · 1 line
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>

#2 lore raw

PATCH 1/1 staging: lustre: lnet: use correct 'magic' test

In reply to Justin Skists

On Mar 21, 2018, at 12:53 PM, Justin Skists <j.skists at gmail.com<mailto:[email protected]>> 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:[email protected]>>
Signed-off-by Justin Skists <j.skists at gmail.com<mailto:[email protected]>>

---
drivers/staging/lustre/lnet/lnet/acceptor.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lnet/lnet/acceptor.c +0 -0
index 13e981781b9a..5648f17eddc0 100644
@@ -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:[email protected]>>

_______________________________________________
lustre-devel mailing list
lustre-devel at lists.lustre.org<mailto:[email protected]>
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>