Re: [PATCH RFC] dcache: permit dynamic_dname()s up to NAME_MAX
From: Luca Boccassi
Date: Tue Mar 31 2026 - 13:57:43 EST
On Tue, 31 Mar 2026 at 15:46, Aleksa Sarai <aleksa@xxxxxxxxxxxx> wrote:
>
> dynamic_dname() has had an implicit limit of 64 characters since it was
> introduced in commit c23fbb6bcb3e ("VFS: delay the dentry name
> generation on sockets and pipes"), however it seems that this was a
> fairly arbitrary number (suspiciously it was double the previously
> hardcoded buffer size).
>
> NAME_MAX seems like a more reasonable and consistent limit for d_name
> lengths. While we're at it, we can also remove the unnecessary
> stack-allocated array and just memmove() the formatted string to the end
> of the buffer.
>
> It should also be noted that at least one driver (in particular,
> liveupdate's usage of anon_inode for session files) already exceeded
> this limit without noticing that readlink(/proc/self/fd/$n) always
> returns -ENAMETOOLONG, so this fixes those drivers as well.
>
> Fixes: 0153094d03df ("liveupdate: luo_session: add sessions support")
> Fixes: c23fbb6bcb3e ("VFS: delay the dentry name generation on sockets and pipes")
> Signed-off-by: Aleksa Sarai <aleksa@xxxxxxxxxxxx>
> ---
> fs/d_path.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
Tested-by: Luca Boccassi <luca.boccassi@xxxxxxxxx>
Thanks, works nicely, tested on top of 7.0-rc5