handshake: set hr_sk field earlier in handshake_req_submit
Subsystems (2)
PATCH 1/1 handshake: set hr_sk field earlier in handshake_req_submit
Otherwise, the request is always hashed with the socket set to a NULL pointer.
--- net/handshake/request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
I think this is the problem I was hitting earlier. Chuck, feel free to fold this into the original patch that adds this code.
net/handshake/request.c +1 -1
@@ -207,6 +207,7 @@ int handshake_req_submit(struct socket *sock, struct handshake_req *req,if (READ_ONCE (hn->hn_pending) >= hn->hn_pending_max) goto out_err; + req->hr_sk = sk; req->hr_odestruct = sk->sk_destruct; sk->sk_destruct = handshake_sk_destruct;spin_lock (&hn->hn_lock);
@@ -230,7 +231,6 @@ int handshake_req_submit(struct socket *sock, struct handshake_req *req,/* Prevent socket release while a handshake request is pending */ sock_hold (sk); - req->hr_sk = sk;trace_handshake_submit (net, req, sk);return 0 ;
Signature · 1 line
2.39.2
Quoted 6 lines · Jeff Layton
Otherwise, the request is always hashed with the socket set to a NULL pointer.
Sounds plausible. I will need to check the clean-up paths too.
Quoted 31 lines
Signed-off-by Jeff Layton <[email protected]>---
net/handshake/request.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)I think this is the problem I was hitting earlier. Chuck, feel free to fold this into the original patch that adds this code.
net/handshake/request.c +1
-1@@ -207,6 +207,7 @@ int handshake_req_submit(struct socket *sock, struct handshake_req *req,if (READ_ONCE (hn->hn_pending) >= hn->hn_pending_max) goto out_err; + req->hr_sk = sk; req->hr_odestruct = sk->sk_destruct; sk->sk_destruct = handshake_sk_destruct;spin_lock (&hn->hn_lock);@@ -230,7 +231,6 @@ int handshake_req_submit(struct socket *sock, struct handshake_req *req,/* Prevent socket release while a handshake request is pending */ sock_hold (sk); - req->hr_sk = sk;trace_handshake_submit (net, req, sk);return 0 ;Signature · 1 line
2.39.2
--
Chuck Lever
Quoted 8 lines · Chuck Lever III
Quoted 5 lines · Jeff Layton
Otherwise, the request is always hashed with the socket set to a NULL pointer.
Sounds plausible. I will need to check the clean-up paths too.
You're right about the error paths. The sock refcounting will need to be fixed up for sure.
With this but fixed on both ends though, it works for me pretty consistently now. I guess I was just unlucky with the hashing!
Quoted 37 lines
Quoted 32 lines
Signed-off-by Jeff Layton <[email protected]>---
net/handshake/request.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)I think this is the problem I was hitting earlier. Chuck, feel free to fold this into the original patch that adds this code.
net/handshake/request.c +1
-1@@ -207,6 +207,7 @@ int handshake_req_submit(struct socket *sock, struct handshake_req *req,if (READ_ONCE (hn->hn_pending) >= hn->hn_pending_max) goto out_err; + req->hr_sk = sk; req->hr_odestruct = sk->sk_destruct; sk->sk_destruct = handshake_sk_destruct;spin_lock (&hn->hn_lock);@@ -230,7 +231,6 @@ int handshake_req_submit(struct socket *sock, struct handshake_req *req,/* Prevent socket release while a handshake request is pending */ sock_hold (sk); - req->hr_sk = sk;trace_handshake_submit (net, req, sk);return 0 ;Signature · 1 line
2.39.2--
Chuck Lever
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 11 lines · Jeff Layton
Quoted 6 lines · Chuck Lever III
Quoted 5 lines · Jeff Layton
Otherwise, the request is always hashed with the socket set to a NULL pointer.
Quoted 7 lines
Quoted 1 line
Sounds plausible. I will need to check the clean-up paths too.
You're right about the error paths. The sock refcounting will need to be fixed up for sure.
With this but fixed on both ends though, it works for me pretty consistently now. I guess I was just unlucky with the hashing!
No, you might be the first person to test this code after I addressed Paolo's reference counting concerns. It was working fine before I made those changes.
--
Chuck Lever