[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b635271e73b35487a06cf17176243e6ce4cfcd58.camel@xry111.site>
Date: Mon, 24 Jun 2024 20:19:33 +0800
From: Xi Ruoyao <xry111@...111.site>
To: Mateusz Guzik <mjguzik@...il.com>, Linus Torvalds
<torvalds@...ux-foundation.org>
Cc: Christian Brauner <brauner@...nel.org>, Alexander Viro
<viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>, Alejandro Colomar
<alx@...nel.org>, Arnd Bergmann <arnd@...db.de>, Huacai Chen
<chenhuacai@...ngson.cn>, Xuerui Wang <kernel@...0n.name>, Jiaxun Yang
<jiaxun.yang@...goat.com>, Icenowy Zheng <uwu@...nowy.me>,
linux-fsdevel@...r.kernel.org, linux-arch@...r.kernel.org,
loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] vfs: Shortcut AT_EMPTY_PATH early for statx, and add
AT_NO_PATH for statx and fstatat
On Mon, 2024-06-24 at 11:04 +0200, Mateusz Guzik wrote:
> Below is a diff which compiles but is untested. It adds AT_EMPTY_PATH +
> NULL as suggsted by Linus, but it can be adjusted for AT_NO_PATH (which
> would be my preffered option, or better yet not do that and add fstatx).
>
> It does not do the hack to 0-check if a pointer was passed along with
> AT_EMPTY_PATH but that again is an easy addition.
>
> Feel free to take without attribution:
I'd still like to make it Co-developed-by: or just From: you. Could you
give a S-o-b?
And with this change AT_FDCWD with AT_EMPTY_PATH and NULL path does not
work. For consistency it'd be better to make it work too:
diff --git a/fs/stat.c b/fs/stat.c
index b0a4db7b90df..d04f7ba46645 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -752,10 +752,14 @@ SYSCALL_DEFINE5(statx,
int ret;
struct filename *name;
- if (filename == NULL && (flags & AT_EMPTY_PATH))
- return do_statx_fd(dfd, flags, mask, buffer);
+ if (filename == NULL && (flags & AT_EMPTY_PATH)) {
+ if (dfd >= 0)
+ return do_statx_fd(dfd, flags, mask, buffer);
+ else
+ name = getname_kernel("");
+ } else
+ name = getname_flags(filename, getname_statx_lookup_flags(flags));
- name = getname_flags(filename, getname_statx_lookup_flags(flags));
ret = do_statx(dfd, name, flags, mask, buffer);
putname(name);
And should we do it for fstatat() as well?
Let's wait for comment from Linus anyway.
--
Xi Ruoyao <xry111@...111.site>
School of Aerospace Science and Technology, Xidian University
Powered by blists - more mailing lists