From: Luis Henriques <luis@igalia.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Amir Goldstein <amir73il@gmail.com>,
"Darrick J. Wong" <djwong@kernel.org>,
Bernd Schubert <bschubert@ddn.com>, Kevin Chen <kchen@ddn.com>,
Horst Birthelmer <hbirthelmer@ddn.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Matt Harvey <mharvey@jumptrading.com>,
kernel-dev@igalia.com
Subject: Re: [RFC PATCH v2 6/6] fuse: implementation of export_operations with FUSE_LOOKUP_HANDLE
Date: Tue, 16 Dec 2025 17:06:25 +0000 [thread overview]
Message-ID: <874ipqcq5q.fsf@wotan.olymp> (raw)
In-Reply-To: <CAJfpegu8-ddQeE9nnY5NH64KQHzr1Zfb=187Pb2uw14oTEPdOw@mail.gmail.com> (Miklos Szeredi's message of "Tue, 16 Dec 2025 11:58:25 +0100")
On Tue, Dec 16 2025, Miklos Szeredi wrote:
> On Fri, 12 Dec 2025 at 19:13, Luis Henriques <luis@igalia.com> wrote:
>>
>> This patch allows the NFS handle to use the new file handle provided by the
>> LOOKUP_HANDLE operation. It still allows the usage of nodeid+generation as
>> an handle if this operation is not supported by the FUSE server or if no
>> handle is available for a specific inode. I.e. it can mix both file handle
>> types FILEID_INO64_GEN{_PARENT} and FILEID_FUSE_WITH{OUT}_PARENT.
>>
>> Signed-off-by: Luis Henriques <luis@igalia.com>
>> ---
>> fs/fuse/export.c | 162 ++++++++++++++++++++++++++++++++++++---
>> include/linux/exportfs.h | 7 ++
>> 2 files changed, 160 insertions(+), 9 deletions(-)
>>
>> diff --git a/fs/fuse/export.c b/fs/fuse/export.c
>> index 4a9c95fe578e..b40d146a32f2 100644
>> --- a/fs/fuse/export.c
>> +++ b/fs/fuse/export.c
>> @@ -3,6 +3,7 @@
>> * FUSE NFS export support.
>> *
>> * Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
>> + * Copyright (C) 2025 Jump Trading LLC, author: Luis Henriques <luis@igalia.com>
>> */
>>
>> #include "fuse_i.h"
>> @@ -10,7 +11,8 @@
>>
>> struct fuse_inode_handle {
>> u64 nodeid;
>> - u32 generation;
>> + u32 generation; /* XXX change to u64, and use fid->i64.ino in encode/decode? */
>> + struct fuse_file_handle fh;
>> };
>>
>> static struct dentry *fuse_get_dentry(struct super_block *sb,
>> @@ -67,8 +69,8 @@ static struct dentry *fuse_get_dentry(struct super_block *sb,
>> return ERR_PTR(err);
>> }
>>
>> -static int fuse_encode_fh(struct inode *inode, u32 *fh, int *max_len,
>> - struct inode *parent)
>> +static int fuse_encode_gen_fh(struct inode *inode, u32 *fh, int *max_len,
>> + struct inode *parent)
>> {
>> int len = parent ? 6 : 3;
>> u64 nodeid;
>> @@ -96,38 +98,180 @@ static int fuse_encode_fh(struct inode *inode, u32 *fh, int *max_len,
>> }
>>
>> *max_len = len;
>> +
>> return parent ? FILEID_INO64_GEN_PARENT : FILEID_INO64_GEN;
>> }
>>
>> -static struct dentry *fuse_fh_to_dentry(struct super_block *sb,
>> - struct fid *fid, int fh_len, int fh_type)
>> +static int fuse_encode_fuse_fh(struct inode *inode, u32 *fh, int *max_len,
>> + struct inode *parent)
>> +{
>> + struct fuse_inode *fi = get_fuse_inode(inode);
>> + struct fuse_inode *fip = NULL;
>> + struct fuse_inode_handle *handle = (void *)fh;
>> + int type = FILEID_FUSE_WITHOUT_PARENT;
>> + int len, lenp = 0;
>> + int buflen = *max_len << 2; /* max_len: number of words */
>> +
>> + len = sizeof(struct fuse_inode_handle) + fi->fh->size;
>> + if (parent) {
>> + fip = get_fuse_inode(parent);
>> + if (fip->fh && fip->fh->size) {
>> + lenp = sizeof(struct fuse_inode_handle) +
>> + fip->fh->size;
>> + type = FILEID_FUSE_WITH_PARENT;
>> + }
>> + }
>> +
>> + if (buflen < (len + lenp)) {
>> + *max_len = (len + lenp) >> 2;
>> + return FILEID_INVALID;
>> + }
>> +
>> + handle[0].nodeid = fi->nodeid;
>> + handle[0].generation = inode->i_generation;
>
> I think it should be either
>
> - encode nodeid + generation (backward compatibility),
>
> - or encode file handle for servers that support it
>
> but not both.
OK, in fact v1 was trying to do something like that, by defining the
handle with this:
struct fuse_inode_handle {
u32 type;
union {
struct {
u64 nodeid;
u32 generation;
};
struct fuse_file_handle fh;
};
};
(The 'type' is likely to be useless, as we know if the server supports fh
or not.)
> Which means that fuse_iget() must be able to search the cache based on
> the handle as well, but that should not be too difficult to implement
> (need to hash the file handle).
Right, I didn't got that far in v1. I'll see what I can come up to.
Doing memcmp()s would definitely be too expensive, so using hashes is the
only way I guess.
Cheers,
--
Luís
next prev parent reply other threads:[~2025-12-16 17:06 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-12 18:12 [RFC PATCH v2 0/6] fuse: LOOKUP_HANDLE operation Luis Henriques
2025-12-12 18:12 ` [RFC PATCH v2 1/6] fuse: store index of the variable length argument Luis Henriques
2025-12-12 18:12 ` [RFC PATCH v2 2/6] fuse: move fuse_entry_out structs out of the stack Luis Henriques
2025-12-15 14:03 ` Bernd Schubert
2025-12-16 10:30 ` Luis Henriques
2025-12-12 18:12 ` [RFC PATCH v2 3/6] fuse: initial infrastructure for FUSE_LOOKUP_HANDLE support Luis Henriques
2025-12-15 13:36 ` Bernd Schubert
2025-12-15 17:06 ` Amir Goldstein
2025-12-15 17:11 ` Bernd Schubert
2025-12-15 18:09 ` Amir Goldstein
2025-12-15 18:23 ` Bernd Schubert
2025-12-16 10:36 ` Luis Henriques
2025-12-16 10:19 ` Miklos Szeredi
2025-12-16 11:33 ` Luis Henriques
2025-12-16 11:46 ` Miklos Szeredi
2025-12-16 12:02 ` Luis Henriques
2025-12-12 18:12 ` [RFC PATCH v2 4/6] fuse: implementation of the FUSE_LOOKUP_HANDLE operation Luis Henriques
2025-12-15 17:39 ` Bernd Schubert
2025-12-16 11:48 ` Luis Henriques
2025-12-17 10:18 ` Amir Goldstein
2025-12-17 14:45 ` Luis Henriques
2025-12-17 15:02 ` Bernd Schubert
2025-12-17 16:53 ` Luis Henriques
2025-12-16 8:49 ` Joanne Koong
2025-12-16 8:54 ` Bernd Schubert
2025-12-17 0:32 ` Joanne Koong
2025-12-17 1:00 ` Darrick J. Wong
2025-12-17 2:48 ` Joanne Koong
2025-12-17 9:38 ` Luis Henriques
2025-12-17 10:08 ` Miklos Szeredi
2025-12-17 16:17 ` Luis Henriques
2025-12-16 10:39 ` Miklos Szeredi
2025-12-16 10:51 ` Amir Goldstein
2025-12-16 11:07 ` Miklos Szeredi
2026-01-09 11:57 ` Luis Henriques
2026-01-09 12:38 ` Miklos Szeredi
2026-01-09 14:45 ` Luis Henriques
2026-01-09 14:56 ` Horst Birthelmer
2026-01-09 17:07 ` Luis Henriques
2026-01-12 7:43 ` Horst Birthelmer
2026-01-09 15:20 ` Miklos Szeredi
2026-01-09 15:03 ` Amir Goldstein
2026-01-09 15:37 ` Miklos Szeredi
2026-01-09 15:56 ` Bernd Schubert
2026-01-09 16:28 ` Miklos Szeredi
2026-01-09 17:16 ` Luis Henriques
2026-01-09 18:29 ` Amir Goldstein
2026-01-09 19:01 ` Miklos Szeredi
2026-01-09 19:28 ` Amir Goldstein
2026-01-09 19:12 ` Bernd Schubert
2026-01-09 19:55 ` Horst Birthelmer
2026-01-21 17:56 ` Luis Henriques
2026-01-21 18:16 ` Horst Birthelmer
2026-01-21 18:28 ` Bernd Schubert
2026-01-21 18:36 ` Horst Birthelmer
2026-01-21 18:49 ` Bernd Schubert
2026-01-21 19:00 ` Horst Birthelmer
2026-01-21 19:03 ` Bernd Schubert
2026-01-21 19:12 ` Horst Birthelmer
2026-01-22 9:52 ` Luis Henriques
2026-01-22 10:20 ` Horst Birthelmer
2026-01-22 10:35 ` Bernd Schubert
2026-01-22 10:53 ` Luis Henriques
2026-01-22 10:59 ` Horst Birthelmer
2026-01-22 11:25 ` Luis Henriques
2026-01-22 11:32 ` Bernd Schubert
2026-01-22 12:34 ` Horst Birthelmer
2025-12-12 18:12 ` [RFC PATCH v2 5/6] fuse: factor out NFS export related code Luis Henriques
2025-12-14 15:13 ` Amir Goldstein
2025-12-15 12:05 ` Luis Henriques
2025-12-12 18:12 ` [RFC PATCH v2 6/6] fuse: implementation of export_operations with FUSE_LOOKUP_HANDLE Luis Henriques
2025-12-16 10:58 ` Miklos Szeredi
2025-12-16 17:06 ` Luis Henriques [this message]
2025-12-16 20:12 ` Horst Birthelmer
2025-12-17 17:02 ` Luis Henriques
2025-12-17 18:02 ` Horst Birthelmer
2025-12-16 11:01 ` Amir Goldstein
2025-12-16 17:26 ` Luis Henriques
2025-12-14 17:02 ` [RFC PATCH v2 0/6] fuse: LOOKUP_HANDLE operation Askar Safin
2025-12-15 12:08 ` Luis Henriques
2025-12-16 0:33 ` Askar Safin
2025-12-16 17:36 ` Luis Henriques
2025-12-16 18:49 ` Bernd Schubert
2025-12-16 22:45 ` Askar Safin
2025-12-25 7:42 ` Askar Safin
2026-01-04 22:38 ` Askar Safin
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=874ipqcq5q.fsf@wotan.olymp \
--to=luis@igalia.com \
--cc=amir73il@gmail.com \
--cc=bschubert@ddn.com \
--cc=djwong@kernel.org \
--cc=hbirthelmer@ddn.com \
--cc=kchen@ddn.com \
--cc=kernel-dev@igalia.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mharvey@jumptrading.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
all inboxes | Powered by JetHome®