Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Zhu Yanjun <yanjun.zhu@linux.dev>,
	jgg@ziepe.ca, leon@kernel.org, zyjzyj2000@gmail.com,
	linux-rdma@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v3 2/4] RDMA/rxe: Add net namespace support for IPv4/IPv6 sockets
Date: Sun, 8 Mar 2026 11:44:22 -0600	[thread overview]
Message-ID: <99e6f2c5-b039-4d47-8674-7d89a83fa849@kernel.org> (raw)
In-Reply-To: <20260308074711.24114-3-yanjun.zhu@linux.dev>

On 3/8/26 12:47 AM, Zhu Yanjun wrote:
> +/*
> + * Called for every existing and added network namespaces
> + */
> +static int __net_init rxe_ns_init(struct net *net)
> +{
> +	/*
> +	 * create (if not present) and access data item in network namespace
> +	 * (net) using the id (net_id)
> +	 */
> +	struct rxe_ns_sock *ns_sk = net_generic(net, rxe_pernet_id);
> +
> +	rcu_assign_pointer(ns_sk->rxe_sk4, NULL); /* initialize sock 4 socket */
> +	rcu_assign_pointer(ns_sk->rxe_sk6, NULL); /* initialize sock 6 socket */
> +	synchronize_rcu();

As I stated in the last review, this is init is not needded. drop it.

See the net/core/net_namespace.c:

static int ops_init(const struct pernet_operations *ops, struct net *net)
{
        struct net_generic *ng;
        int err = -ENOMEM;
        void *data = NULL;

        if (ops->id) {
                data = kzalloc(ops->size, GFP_KERNEL);
                if (!data)
                        goto out;

                err = net_assign_generic(net, *ops->id, data);
                if (err)
                        goto cleanup;
        }

from there the request is to add a comment about deferred socket created
to explain why _init and _exit are assymetrical.

> +
> +	return 0;
> +}
> +
> +static void __net_exit rxe_ns_exit(struct net *net)
> +{
> +	/*
> +	 * called when the network namespace is removed
> +	 */
> +	struct rxe_ns_sock *ns_sk = net_generic(net, rxe_pernet_id);
> +	struct sock *rxe_sk4 = NULL;
> +	struct sock *rxe_sk6 = NULL;

again, init is not needed. They are set below before use.

I am beginning to think you dropped my review comments from the last
round ....

> +
> +	rcu_read_lock();
> +	rxe_sk4 = rcu_dereference(ns_sk->rxe_sk4);
> +	rxe_sk6 = rcu_dereference(ns_sk->rxe_sk6);
> +	rcu_read_unlock();
> +
> +	/* close socket */
> +	if (rxe_sk4 && rxe_sk4->sk_socket) {
> +		udp_tunnel_sock_release(rxe_sk4->sk_socket);
> +		rcu_assign_pointer(ns_sk->rxe_sk4, NULL);
> +		synchronize_rcu();

yea, I commented on this too.

I am not wasting any more time on this version. Either address my
comments from v1 or explain why you should not in that email.


  reply	other threads:[~2026-03-08 17:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-08  7:47 [PATCH v3 0/4]RDMA/rxe: Add the support that rxe can work in net namespace Zhu Yanjun
2026-03-08  7:47 ` [PATCH v3 1/4] RDMA/nldev: Add dellink function pointer Zhu Yanjun
2026-03-08  7:47 ` [PATCH v3 2/4] RDMA/rxe: Add net namespace support for IPv4/IPv6 sockets Zhu Yanjun
2026-03-08 17:44   ` David Ahern [this message]
2026-03-08 22:52     ` Zhu Yanjun
2026-03-08  7:47 ` [PATCH v3 3/4] RDMA/rxe: Support RDMA link creation and destruction per net namespace Zhu Yanjun
2026-03-08  7:47 ` [PATCH v3 4/4] RDMA/rxe: Add testcase for net namespace rxe Zhu Yanjun
2026-03-08  7:49   ` Zhu Yanjun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99e6f2c5-b039-4d47-8674-7d89a83fa849@kernel.org \
    --to=dsahern@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=yanjun.zhu@linux.dev \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox