* [PATCH] bpf: Use E2BIG instead of ENOENT
@ 2023-11-04 2:44 Tao Chen
2023-11-04 20:54 ` Alexei Starovoitov
0 siblings, 1 reply; 3+ messages in thread
From: Tao Chen @ 2023-11-04 2:44 UTC (permalink / raw)
To: song, jolsa, ast, daniel, andrii, yonghong.song, martin.lau,
john.fastabend, haoluo
Cc: bpf, linux-kernel, chen.dylane
Use E2BIG instead of ENOENT when the key size beyond the buckets size,
it seems more meaningful.
Signed-off-by: Tao Chen <chen.dylane@gmail.com>
---
kernel/bpf/stackmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 458bb80b14d5..b78369bdec8d 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -570,7 +570,7 @@ int bpf_stackmap_copy(struct bpf_map *map, void *key, void *value)
u32 id = *(u32 *)key, trace_len;
if (unlikely(id >= smap->n_buckets))
- return -ENOENT;
+ return -E2BIG;
bucket = xchg(&smap->buckets[id], NULL);
if (!bucket)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bpf: Use E2BIG instead of ENOENT
2023-11-04 2:44 [PATCH] bpf: Use E2BIG instead of ENOENT Tao Chen
@ 2023-11-04 20:54 ` Alexei Starovoitov
[not found] ` <CA+92Ff+ZW5wu3mZFs--nxcyJyc7YxEhP-yuL-BEsWzVChR9Jdg@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Alexei Starovoitov @ 2023-11-04 20:54 UTC (permalink / raw)
To: Tao Chen
Cc: Song Liu, Jiri Olsa, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Yonghong Song, Martin KaFai Lau, John Fastabend,
Hao Luo, bpf, LKML
On Fri, Nov 3, 2023 at 7:44 PM Tao Chen <chen.dylane@gmail.com> wrote:
>
> Use E2BIG instead of ENOENT when the key size beyond the buckets size,
> it seems more meaningful.
seems more meaningful?
Sorry. That's hardly a reason to break someone's code.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bpf: Use E2BIG instead of ENOENT
[not found] ` <CA+92Ff+ZW5wu3mZFs--nxcyJyc7YxEhP-yuL-BEsWzVChR9Jdg@mail.gmail.com>
@ 2023-11-06 16:13 ` Tao Chen
0 siblings, 0 replies; 3+ messages in thread
From: Tao Chen @ 2023-11-06 16:13 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Song Liu, Jiri Olsa, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Yonghong Song, Martin KaFai Lau, John Fastabend,
Hao Luo, bpf, LKML
Hi, Alexei, the delete element api of stackmap return E2BIG when the key
size beyond the buckets size, so i try to keep the same approach. Maybe
it's not necessary, anyway, thanks for your reply.
在 2023/11/6 下午11:59, Tao Chen 写道:
>
>
> ---------- Forwarded message ---------
> 发件人: *Alexei Starovoitov* <alexei.starovoitov@gmail.com
> <mailto:alexei.starovoitov@gmail.com>>
> Date: 2023年11月5日周日 04:54
> Subject: Re: [PATCH] bpf: Use E2BIG instead of ENOENT
> To: Tao Chen <chen.dylane@gmail.com <mailto:chen.dylane@gmail.com>>
> Cc: Song Liu <song@kernel.org <mailto:song@kernel.org>>, Jiri Olsa
> <jolsa@kernel.org <mailto:jolsa@kernel.org>>, Alexei Starovoitov
> <ast@kernel.org <mailto:ast@kernel.org>>, Daniel Borkmann
> <daniel@iogearbox.net <mailto:daniel@iogearbox.net>>, Andrii Nakryiko
> <andrii@kernel.org <mailto:andrii@kernel.org>>, Yonghong Song
> <yonghong.song@linux.dev <mailto:yonghong.song@linux.dev>>, Martin KaFai
> Lau <martin.lau@linux.dev <mailto:martin.lau@linux.dev>>, John Fastabend
> <john.fastabend@gmail.com <mailto:john.fastabend@gmail.com>>, Hao Luo
> <haoluo@google.com <mailto:haoluo@google.com>>, bpf <bpf@vger.kernel.org
> <mailto:bpf@vger.kernel.org>>, LKML <linux-kernel@vger.kernel.org
> <mailto:linux-kernel@vger.kernel.org>>
>
>
> On Fri, Nov 3, 2023 at 7:44 PM Tao Chen <chen.dylane@gmail.com
> <mailto:chen.dylane@gmail.com>> wrote:
> >
> > Use E2BIG instead of ENOENT when the key size beyond the buckets size,
> > it seems more meaningful.
>
> seems more meaningful?
> Sorry. That's hardly a reason to break someone's code.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-06 16:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-04 2:44 [PATCH] bpf: Use E2BIG instead of ENOENT Tao Chen
2023-11-04 20:54 ` Alexei Starovoitov
[not found] ` <CA+92Ff+ZW5wu3mZFs--nxcyJyc7YxEhP-yuL-BEsWzVChR9Jdg@mail.gmail.com>
2023-11-06 16:13 ` Tao Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®