bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* bpf: inode_storage lookup element unexpected behaviour‏‏
@ 2021-03-04 15:11 Tal Lossos
  2021-03-04 19:43 ` Yonghong Song
  0 siblings, 1 reply; 2+ messages in thread
From: Tal Lossos @ 2021-03-04 15:11 UTC (permalink / raw)
  To: bpf; +Cc: kpsingh, gilad.reti

Hi,
For some reason I've noticed that the current inode_storage's
lookup_elem func returns NULL for a bad fd, which causes ENOENT in
bpf_map_copy_value.
This behaviour is different from the other inode_storage's functions
like update_elem which returns EBADF for a bad fd.

We've checked in the other local storage maps (tasks and sock) and
they return EBADF for a bad fd in their lookup_elem func.
Should inode_storage's lookup_elem func be changed for this same behaviour?
I could submit a patch which changes that behaviour.

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: bpf: inode_storage lookup element unexpected behaviour‏‏
  2021-03-04 15:11 bpf: inode_storage lookup element unexpected behaviour‏‏ Tal Lossos
@ 2021-03-04 19:43 ` Yonghong Song
  0 siblings, 0 replies; 2+ messages in thread
From: Yonghong Song @ 2021-03-04 19:43 UTC (permalink / raw)
  To: Tal Lossos, bpf; +Cc: kpsingh, gilad.reti



On 3/4/21 7:11 AM, Tal Lossos wrote:
> Hi,
> For some reason I've noticed that the current inode_storage's
> lookup_elem func returns NULL for a bad fd, which causes ENOENT in
> bpf_map_copy_value.
> This behaviour is different from the other inode_storage's functions
> like update_elem which returns EBADF for a bad fd.
> 
> We've checked in the other local storage maps (tasks and sock) and
> they return EBADF for a bad fd in their lookup_elem func.
> Should inode_storage's lookup_elem func be changed for this same behaviour?
> I could submit a patch which changes that behaviour.

Yes, -EBADF is better than -ENOENT. Please go ahead to submit a patch.
Thanks!

> 
> Thanks.
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-04 19:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-04 15:11 bpf: inode_storage lookup element unexpected behaviour‏‏ Tal Lossos
2021-03-04 19:43 ` Yonghong Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).