diff mbox series

[v2,2/2] fuse: Increase FUSE_NAME_MAX to PATH_MAX

Message ID 20241213-fuse_name_max-limit-6-13-v2-2-39fec5253632@ddn.com (mailing list archive)
State New
Headers show
Series fuse: Increase FUSE_NAME_MAX limit | expand

Commit Message

Bernd Schubert Dec. 13, 2024, 4:01 p.m. UTC
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

Signed-off-by: Bernd Schubert <bschubert@ddn.com>
---
 fs/fuse/fuse_i.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jingbo Xu Dec. 14, 2024, 2:07 a.m. UTC | #1
On 12/14/24 12:01 AM, Bernd Schubert wrote:
> 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
> 
> Signed-off-by: Bernd Schubert <bschubert@ddn.com>

LGTM.

Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com>


> ---
>  fs/fuse/fuse_i.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
> index 74744c6f286003251564d1235f4d2ca8654d661b..a47a0ba3ccad7d9cbf105fcae728712d5721850c 100644
> --- a/fs/fuse/fuse_i.h
> +++ b/fs/fuse/fuse_i.h
> @@ -38,8 +38,8 @@
>  /** Bias for fi->writectr, meaning new writepages must not be sent */
>  #define FUSE_NOWRITE INT_MIN
>  
> -/** It could be as large as PATH_MAX, but would that have any uses? */
> -#define FUSE_NAME_MAX 1024
> +/** Maximum length of a filename, not including terminating null */
> +#define FUSE_NAME_MAX (PATH_MAX - 1)
>  
>  /** Number of dentries for each connection in the control filesystem */
>  #define FUSE_CTL_NUM_DENTRIES 5
>
Shachar Sharon Dec. 15, 2024, 10:49 a.m. UTC | #2
Large file-names (up to 4095) may cause the encoded input of
FUSE_SYMLINK and FUSE_RENAME to exceed the default value of
FUSE_MIN_READ_BUFFER (8192). Whoever implements such a FUSE
file-system should keep this in mind.

- Shachar.


On Fri, Dec 13, 2024 at 6:02 PM Bernd Schubert <bschubert@ddn.com> wrote:
>
> 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
>
> Signed-off-by: Bernd Schubert <bschubert@ddn.com>
> ---
>  fs/fuse/fuse_i.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
> index 74744c6f286003251564d1235f4d2ca8654d661b..a47a0ba3ccad7d9cbf105fcae728712d5721850c 100644
> --- a/fs/fuse/fuse_i.h
> +++ b/fs/fuse/fuse_i.h
> @@ -38,8 +38,8 @@
>  /** Bias for fi->writectr, meaning new writepages must not be sent */
>  #define FUSE_NOWRITE INT_MIN
>
> -/** It could be as large as PATH_MAX, but would that have any uses? */
> -#define FUSE_NAME_MAX 1024
> +/** Maximum length of a filename, not including terminating null */
> +#define FUSE_NAME_MAX (PATH_MAX - 1)
>
>  /** Number of dentries for each connection in the control filesystem */
>  #define FUSE_CTL_NUM_DENTRIES 5
>
> --
> 2.43.0
>
Bernd Schubert Dec. 16, 2024, 9:19 p.m. UTC | #3
On 12/14/24 03:07, Jingbo Xu wrote:
> 
> 
> On 12/14/24 12:01 AM, Bernd Schubert wrote:
>> 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
>>
>> Signed-off-by: Bernd Schubert <bschubert@ddn.com>
> 
> LGTM.
> 
> Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com>
> 

Thank you! I didn't add your reviewed-by yet, as I added some changes to
address Shachars concern about operations that need two hold two
file names, but fuse server might use FUSE_MIN_READ_BUFFER.


Thanks,
Bernd
diff mbox series

Patch

diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 74744c6f286003251564d1235f4d2ca8654d661b..a47a0ba3ccad7d9cbf105fcae728712d5721850c 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -38,8 +38,8 @@ 
 /** Bias for fi->writectr, meaning new writepages must not be sent */
 #define FUSE_NOWRITE INT_MIN
 
-/** It could be as large as PATH_MAX, but would that have any uses? */
-#define FUSE_NAME_MAX 1024
+/** Maximum length of a filename, not including terminating null */
+#define FUSE_NAME_MAX (PATH_MAX - 1)
 
 /** Number of dentries for each connection in the control filesystem */
 #define FUSE_CTL_NUM_DENTRIES 5