From: Bernd Schubert <bernd@bsbernd.com>
To: Allison Karlitskaya <allison.karlitskaya@redhat.com>, miklos@szeredi.hu
Cc: linux-fsdevel@vger.kernel.org, lis@redhat.com
Subject: Re: [PATCH] fuse: add max_stack_depth to fuse_init_in
Date: Wed, 14 May 2025 15:32:26 +0200 [thread overview]
Message-ID: <664ccbcb-0c75-4673-9a5d-85ee45f3e2c1@bsbernd.com> (raw)
In-Reply-To: <20250514121415.2116216-1-allison.karlitskaya@redhat.com>
On 5/14/25 14:14, Allison Karlitskaya wrote:
> FILESYSTEM_MAX_STACK_DEPTH is defined privately inside of the kernel,
> but you need to know its value to properly implement fd passthrough on a
> FUSE filesystem. So far most users have been assuming its current value
> of 2, but there's nothing that says that it won't change.
>
> Use one of the unused fields in fuse_init_in to add a max_stack_depth
> uint32_t (matching the max_stack_depth uint32_t in fuse_init_out). If
> CONFIG_FUSE_PASSTHROUGH is configured then this is set to the maximum
> value that the kernel will accept for the corresponding field in
> fuse_init_out (ie: FILESYSTEM_MAX_STACK_DEPTH).
>
> Let's not treat this as an ABI change: this struct is zero-initialized
> and the maximum max_stack_depth is non-zero (and always will be) so
> userspace can easily find out for itself if the value is present in the
> struct or not.
>
> Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
> ---
> fs/fuse/inode.c | 4 +++-
> include/uapi/linux/fuse.h | 3 ++-
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index fd48e8d37f2e..46fd37eec9ae 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -1497,8 +1497,10 @@ void fuse_send_init(struct fuse_mount *fm)
> #endif
> if (fm->fc->auto_submounts)
> flags |= FUSE_SUBMOUNTS;
> - if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
> + if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH)) {
> flags |= FUSE_PASSTHROUGH;
> + ia->in.max_stack_depth = FILESYSTEM_MAX_STACK_DEPTH;
> + }
>
> /*
> * This is just an information flag for fuse server. No need to check
> diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
> index 5ec43ecbceb7..eb5d77d50176 100644
> --- a/include/uapi/linux/fuse.h
> +++ b/include/uapi/linux/fuse.h
> @@ -895,7 +895,8 @@ struct fuse_init_in {
> uint32_t max_readahead;
> uint32_t flags;
> uint32_t flags2;
> - uint32_t unused[11];
> + uint32_t max_stack_depth;
Objections to make this a uint8_t? In fuse_init_out it just had slipped
through in review. (And I wonder a bit if we should post change it in
fuse_init_out.
Thanks,
Bernd
next prev parent reply other threads:[~2025-05-14 13:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-05 21:02 Request for clarification about FILESYSTEM_MAX_STACK_DEPTH Allison Karlitskaya
2025-05-13 10:21 ` Miklos Szeredi
2025-05-14 12:14 ` [PATCH] fuse: add max_stack_depth to fuse_init_in Allison Karlitskaya
2025-05-14 13:32 ` Bernd Schubert [this message]
2025-05-15 8:42 ` Miklos Szeredi
2025-05-15 10:10 ` Christian Brauner
2025-05-16 9:07 ` Miklos Szeredi
2025-05-26 8:50 ` Allison Karlitskaya
2025-05-26 10:11 ` Amir Goldstein
2025-05-27 14:30 ` Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=664ccbcb-0c75-4673-9a5d-85ee45f3e2c1@bsbernd.com \
--to=bernd@bsbernd.com \
--cc=allison.karlitskaya@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=lis@redhat.com \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).