fuse: Increase FUSE_NAME_MAX to PATH_MAX
authorBernd Schubert <bschubert@ddn.com>
Mon, 16 Dec 2024 21:14:07 +0000 (22:14 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 31 Mar 2025 12:59:27 +0000 (14:59 +0200)
commit27992ef80770d61a57f6c3a551735b08cefdffa3
tree50e66236fc0e87e387dc44ba08114a0c266e0bf8
parent2412085da370836945c2daa61c5cee38dd979e0d
fuse: Increase FUSE_NAME_MAX to PATH_MAX

Our file system has a translation capability for S3-to-posix.
The current value of 1kiB is enough to cover S3 keys, but
does not allow encoding of %xx escape characters.
The limit is increased to (PATH_MAX - 1), as we need
3 x 1024 and that is close to PATH_MAX (4kB) already.
-1 is used as the terminating null is not included in the
length calculation.

Testing large file names was hard with libfuse/example file systems,
so I created a new memfs that does not have a 255 file name length
limitation.
https://github.com/libfuse/libfuse/pull/1077

The connection is initialized with FUSE_NAME_LOW_MAX, which
is set to the previous value of FUSE_NAME_MAX of 1024. With
FUSE_MIN_READ_BUFFER of 8192 that is enough for two file names
+ fuse headers.
When FUSE_INIT reply sets max_pages to a value > 1 we know
that fuse daemon supports request buffers of at least 2 pages
(+ header) and can therefore hold 2 x PATH_MAX file names - operations
like rename or link that need two file names are no issue then.

Signed-off-by: Bernd Schubert <bschubert@ddn.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/dev.c
fs/fuse/dir.c
fs/fuse/fuse_i.h
fs/fuse/inode.c