[PATCH 08/21] Wake peer send thread during socket_destroy

Valerie Aurora val at versity.com
Tue Feb 11 13:19:05 PST 2025


The send thread of a peer socket may be asleep on a wait queue. Wake
it so that the socket destroy can complete.

Signed-off-by: Valerie Aurora <val at versity.com>
---
 shared/mtr-socket.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/shared/mtr-socket.c b/shared/mtr-socket.c
index f676071..c89f79a 100644
--- a/shared/mtr-socket.c
+++ b/shared/mtr-socket.c
@@ -59,6 +59,7 @@ static void shutdown_peer(struct socket_peer_info *pinf, int err)
 		thread_stop_indicate(&pinf->recv_thr);
 		if (pinf->fd >= 0)
 			shutdown(pinf->fd, SHUT_RDWR);
+		wake_up(&pinf->waitq);
 	}
 
 	/* don't really mind if this races */
@@ -351,6 +352,8 @@ static void socket_destroy_peer(void *info)
 
 	thread_stop_wait(&pinf->connect_thr);
 	thread_stop_wait(&pinf->listen_thr);
+	thread_stop_indicate(&pinf->send_thr);
+	wake_up(&pinf->waitq);
 	thread_stop_wait(&pinf->send_thr);
 	thread_stop_wait(&pinf->recv_thr);
 
-- 
2.48.1




More information about the ngnfs-devel mailing list