Re: Reaching official SMC maintainers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/4/24 13:51, Wen Gu wrote:

IMHO, if we want to address the problem of fasync_struct entries being
incorrectly inserted to old socket, we may have to change the general code.

BTW what about using shared wait queue? Just to illustrate an idea:

diff --git a/include/linux/net.h b/include/linux/net.h
index c9b4a63791a4..02df64747db7 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -126,6 +126,7 @@ struct socket {
 	const struct proto_ops	*ops; /* Might change with IPV6_ADDRFORM or MPTCP. */

 	struct socket_wq	wq;
+	struct socket_wq	*shared_wq;
 };

 /*
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 0f53a5c6fd9d..f04d61e316b2 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -3360,6 +3360,9 @@ static int __smc_create(struct net *net, struct socket *sock, int protocol,
 		smc->clcsock = clcsock;
 	}

+	sock->shared_wq = &smc->shared_wq;
+	smc->clcsock->shared_wq = &smc->shared_wq;
+
 out:
 	return rc;
 }
diff --git a/net/smc/smc.h b/net/smc/smc.h
index df64efd2dee8..26e66c289d4f 100644
--- a/net/smc/smc.h
+++ b/net/smc/smc.h
@@ -287,6 +287,7 @@ struct smc_sock {				/* smc sock container */
 						/* protects clcsock of a listen
 						 * socket
 						 * */
+	struct socket_wq	shared_wq;
 };

 #define smc_sk(ptr) container_of_const(ptr, struct smc_sock, sk)
diff --git a/net/socket.c b/net/socket.c
index ed3df2f749bf..9b9e6932906f 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1437,7 +1437,8 @@ static int sock_fasync(int fd, struct file *filp, int on)
 {
 	struct socket *sock = filp->private_data;
 	struct sock *sk = sock->sk;
-	struct socket_wq *wq = &sock->wq;
+	struct socket_wq *wq = (unlikely(sock->shared_wq) ?
+				sock->shared_wq : &sock->wq);

 	if (sk == NULL)
 		return -EINVAL;

Dmitry





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux