summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAmery Hung <ameryhung@gmail.com>2026-02-05 14:29:02 -0800
committerMartin KaFai Lau <martin.lau@kernel.org>2026-02-06 14:28:59 -0800
commit403e935f915896243ff93f9a2ff44e5bb6619032 (patch)
tree37669b2c1ae25f1a3c5dccafa648a98b51a6640d /net
parentfd103ffc57c9a3b8b76bc852ffae5eb630a6ded4 (diff)
bpf: Convert bpf_selem_unlink to failable
To prepare changing both bpf_local_storage_map_bucket::lock and bpf_local_storage::lock to rqspinlock, convert bpf_selem_unlink() to failable. It still always succeeds and returns 0 until the change happens. No functional change. Open code bpf_selem_unlink_storage() in the only caller, bpf_selem_unlink(), since unlink_map and unlink_storage must be done together after all the necessary locks are acquired. For bpf_local_storage_map_free(), ignore the return from bpf_selem_unlink() for now. A later patch will allow it to unlink selems even when failing to acquire locks. Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Amery Hung <ameryhung@gmail.com> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Link: https://patch.msgid.link/20260205222916.1788211-5-ameryhung@gmail.com
Diffstat (limited to 'net')
-rw-r--r--net/core/bpf_sk_storage.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c
index 0b85d8f2c17e..d7b5c4551997 100644
--- a/net/core/bpf_sk_storage.c
+++ b/net/core/bpf_sk_storage.c
@@ -40,9 +40,7 @@ static int bpf_sk_storage_del(struct sock *sk, struct bpf_map *map)
if (!sdata)
return -ENOENT;
- bpf_selem_unlink(SELEM(sdata), false);
-
- return 0;
+ return bpf_selem_unlink(SELEM(sdata), false);
}
/* Called by __sk_destruct() & bpf_sk_storage_clone() */