BPF List
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: jakub@cloudflare.com, rivendell7@gmail.com, kuniyu@amazon.com
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH bpf 2/5] bpf: sockmap, added comments describing update proto rules
Date: Thu, 21 Dec 2023 15:23:24 -0800	[thread overview]
Message-ID: <20231221232327.43678-3-john.fastabend@gmail.com> (raw)
In-Reply-To: <20231221232327.43678-1-john.fastabend@gmail.com>

Add a comment describing that the psock update proto callbback can be
called multiple times and this must be safe.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
 include/linux/skmsg.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h
index c953b8c0d2f4..888a4b217829 100644
--- a/include/linux/skmsg.h
+++ b/include/linux/skmsg.h
@@ -100,6 +100,11 @@ struct sk_psock {
 	void (*saved_close)(struct sock *sk, long timeout);
 	void (*saved_write_space)(struct sock *sk);
 	void (*saved_data_ready)(struct sock *sk);
+	/* psock_update_sk_prot may be called with restore=false many times
+	 * so the handler must be safe for this case. It will be called
+	 * exactly once with restore=true when the psock is being destroyed
+	 * and psock refcnt is zero, but before an RCU grace period.
+	 */
 	int  (*psock_update_sk_prot)(struct sock *sk, struct sk_psock *psock,
 				     bool restore);
 	struct proto			*sk_proto;
-- 
2.33.0


  parent reply	other threads:[~2023-12-21 23:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21 23:23 [PATCH bpf 0/5] fix sockmap + stream af_unix memleak John Fastabend
2023-12-21 23:23 ` [PATCH bpf 1/5] bpf: sockmap, fix proto update hook to avoid dup calls John Fastabend
2024-01-02 12:00   ` Jakub Sitnicki
2024-01-04  1:00     ` Martin KaFai Lau
2024-01-04  3:47       ` John Fastabend
2023-12-21 23:23 ` John Fastabend [this message]
2023-12-21 23:23 ` [PATCH bpf 3/5] bpf: sockmap, add tests for proto updates many to single map John Fastabend
2023-12-21 23:23 ` [PATCH bpf 4/5] bpf: sockmap, add tests for proto updates single socket to many map John Fastabend
2023-12-21 23:23 ` [PATCH bpf 5/5] bpf: sockmap, add tests for proto updates replace socket John Fastabend
2024-01-02 15:18 ` [PATCH bpf 0/5] fix sockmap + stream af_unix memleak Jakub Sitnicki
2024-01-02 23:49   ` John Fastabend
2024-01-04  1:00 ` patchwork-bot+netdevbpf

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=20231221232327.43678-3-john.fastabend@gmail.com \
    --to=john.fastabend@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=jakub@cloudflare.com \
    --cc=kuniyu@amazon.com \
    --cc=netdev@vger.kernel.org \
    --cc=rivendell7@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