Re: [PATCH] vfs: Add AT_EMPTY_PATH_NOCHECK as unchecked AT_EMPTY_PATH

2024-06-25 Thread Christian Brauner
On Sat, Jun 22, 2024 at 03:41:19PM GMT, Linus Torvalds wrote: > On Sat, 22 Jun 2024 at 14:25, Mateusz Guzik wrote: > > > > +cc Linus > > Thanks. > > > To sum up the problem: stat and statx met with "" + AT_EMPTY_PATH have > > more work to do than fstat and its hypotethical statx counterpart: >

Re: [PATCH] vfs: Add AT_EMPTY_PATH_NOCHECK as unchecked AT_EMPTY_PATH

2024-06-23 Thread Xi Ruoyao
On Sun, 2024-06-23 at 14:04 +0200, Mateusz Guzik wrote: > On Sun, Jun 23, 2024 at 3:22 AM Xi Ruoyao wrote: > > > > On Sun, 2024-06-23 at 03:07 +0200, Mateusz Guzik wrote: > > > On Sun, Jun 23, 2024 at 2:59 AM Xi Ruoyao > > > wrote: > > > > > > > > On Sat, 2024-06-22 at 15:41 -0700, Linus

Re: [PATCH] vfs: Add AT_EMPTY_PATH_NOCHECK as unchecked AT_EMPTY_PATH

2024-06-23 Thread Mateusz Guzik
On Sun, Jun 23, 2024 at 3:22 AM Xi Ruoyao wrote: > > On Sun, 2024-06-23 at 03:07 +0200, Mateusz Guzik wrote: > > On Sun, Jun 23, 2024 at 2:59 AM Xi Ruoyao wrote: > > > > > > On Sat, 2024-06-22 at 15:41 -0700, Linus Torvalds wrote: > > > > > > > I do think that we should make AT_EMPTY_PATH with a

Re: [PATCH] vfs: Add AT_EMPTY_PATH_NOCHECK as unchecked AT_EMPTY_PATH

2024-06-22 Thread Xi Ruoyao
On Sun, 2024-06-23 at 03:07 +0200, Mateusz Guzik wrote: > On Sun, Jun 23, 2024 at 2:59 AM Xi Ruoyao wrote: > > > > On Sat, 2024-06-22 at 15:41 -0700, Linus Torvalds wrote: > > > > > I do think that we should make AT_EMPTY_PATH with a NULL path > > > "JustWork(tm)", because the stupid "look if

Re: [PATCH] vfs: Add AT_EMPTY_PATH_NOCHECK as unchecked AT_EMPTY_PATH

2024-06-22 Thread Mateusz Guzik
On Sun, Jun 23, 2024 at 2:59 AM Xi Ruoyao wrote: > > On Sat, 2024-06-22 at 15:41 -0700, Linus Torvalds wrote: > > > I do think that we should make AT_EMPTY_PATH with a NULL path > > "JustWork(tm)", because the stupid "look if the pathname is empty" is > > horrible. > > > > But moving that check

Re: [PATCH] vfs: Add AT_EMPTY_PATH_NOCHECK as unchecked AT_EMPTY_PATH

2024-06-22 Thread Xi Ruoyao
On Sat, 2024-06-22 at 15:41 -0700, Linus Torvalds wrote: > I do think that we should make AT_EMPTY_PATH with a NULL path > "JustWork(tm)", because the stupid "look if the pathname is empty" is > horrible. > > But moving that check into getname() is *NOT* the right answer, > because by the time

Re: [PATCH] vfs: Add AT_EMPTY_PATH_NOCHECK as unchecked AT_EMPTY_PATH

2024-06-22 Thread Linus Torvalds
On Sat, 22 Jun 2024 at 14:25, Mateusz Guzik wrote: > > +cc Linus Thanks. > To sum up the problem: stat and statx met with "" + AT_EMPTY_PATH have > more work to do than fstat and its hypotethical statx counterpart: > - buf alloc/free for the path > - userspace access (very painful on x86_64 +

Re: [PATCH] vfs: Add AT_EMPTY_PATH_NOCHECK as unchecked AT_EMPTY_PATH

2024-06-22 Thread Mateusz Guzik
+cc Linus On Sat, Jun 22, 2024 at 06:56:08PM +0800, Xi Ruoyao wrote: > It's cheap to check if the path is empty in the userspace, but expensive > to check if a userspace string is empty from the kernel. So using statx > and AT_EMPTY_PATH to implement fstat is slower than a "native" fstat > call.

[PATCH] vfs: Add AT_EMPTY_PATH_NOCHECK as unchecked AT_EMPTY_PATH

2024-06-22 Thread Xi Ruoyao
It's cheap to check if the path is empty in the userspace, but expensive to check if a userspace string is empty from the kernel. So using statx and AT_EMPTY_PATH to implement fstat is slower than a "native" fstat call. But for arch/loongarch fstat does not exist so we have to use statx, and on