All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Bernd Schubert <bernd.schubert@fastmail.fm>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	Vivek Goyal <vgoyal@redhat.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Hanna Reitz <hreitz@redhat.com>
Subject: Re: Persistent FUSE file handles (Was: virtiofs uuid and file handles)
Date: Sun, 11 Sep 2022 18:29:39 +0300	[thread overview]
Message-ID: <CAOQ4uxiffF6FKs_My0qxgCnPeeXKSpvzp0-iyjxno=H=Hrn-3g@mail.gmail.com> (raw)
In-Reply-To: <52a25e2e-8756-b9a9-db7e-61807933a395@fastmail.fm>

On Sun, Sep 11, 2022 at 6:16 PM Bernd Schubert
<bernd.schubert@fastmail.fm> wrote:
>
>
>
> On 9/11/22 12:14, Amir Goldstein wrote:
> > On Wed, Sep 23, 2020 at 10:44 AM Miklos Szeredi <miklos@szeredi.hu> wrote:
> >>
> >> One proposal was to add  LOOKUP_HANDLE operation that is similar to
> >> LOOKUP except it takes a {variable length handle, name} as input and
> >> returns a variable length handle *and* a u64 node_id that can be used
> >> normally for all other operations.
> >>
> >> The advantage of such a scheme for virtio-fs (and possibly other fuse
> >> based fs) would be that userspace need not keep a refcounted object
> >> around until the kernel sends a FORGET, but can prune its node ID
> >> based cache at any time.   If that happens and a request from the
> >> client (kernel) comes in with a stale node ID, the server will return
> >> -ESTALE and the client can ask for a new node ID with a special
> >> lookup_handle(fh, NULL).
> >>
> >> Disadvantages being:
> >>
> >>   - cost of generating a file handle on all lookups
> >>   - cost of storing file handle in kernel icache
> >>
> >> I don't think either of those are problematic in the virtiofs case.
> >> The cost of having to keep fds open while the client has them in its
> >> cache is much higher.
> >>
> >
> > I was thinking of taking a stab at LOOKUP_HANDLE for a generic
> > implementation of persistent file handles for FUSE.
> >
> > The purpose is "proper" NFS export support for FUSE.
> > "proper" being survives server restart.
>
> Wouldn't fuse just need to get struct export_operations additions to
> encode and decode handles?
>

FUSE already implements those, but not in a "proper" way, because
there is nothing guaranteeing the persistence of the FUSE file handles.

As a result, when exporting some FUSE fs to NFS and the server is
restarted, NFS client may read a file A and get the content of file B,
because after server restart, FUSE file B got the node id that file A
had before restart.

This is not a hypothetical use case, I have seen this happen.

> >
> > I realize there is an ongoing effort to use file handles in the virtiofsd
> > instead of open fds and that LOOKUP_HANDLE could assist in that
> > effort, but that is an added benefit.
> >
> > I have a C++ implementation [1] which sort of supports persistent
> > file handles, but not in a generic manner.
>
> How does this interact with exportfs?
>

It makes use of internal fs knowledge to encode/decode ext4/xfs
file handles into the 64bit FUSE node id.

This sort of works, but it is not generic.

Thanks,
Amir.

  reply	other threads:[~2022-09-11 15:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a8828676-210a-99e8-30d7-6076f334ed71@virtuozzo.com>
     [not found] ` <CAOQ4uxgZ08ePA5WFOYFoLZaq_-Kjr-haNzBN5Aj3MfF=f9pjdg@mail.gmail.com>
     [not found]   ` <1bb71cbf-0a10-34c7-409d-914058e102f6@virtuozzo.com>
     [not found]     ` <CAOQ4uxieqnKENV_kJYwfcnPjNdVuqH3BnKVx_zLz=N_PdAguNg@mail.gmail.com>
     [not found]       ` <dc696835-bbb5-ed4e-8708-bc828d415a2b@virtuozzo.com>
     [not found]         ` <CAOQ4uxg0XVEEzc+HyyC63WWZuA2AsRjJmbZBuNimtj=t+quVyg@mail.gmail.com>
     [not found]           ` <20200922210445.GG57620@redhat.com>
2020-09-23  2:49             ` virtiofs uuid and file handles Amir Goldstein
2020-09-23  7:44               ` Miklos Szeredi
2020-09-23  9:56                 ` Amir Goldstein
2020-09-23 11:12                   ` Miklos Szeredi
2021-05-29 16:05                     ` Amir Goldstein
2021-05-31 14:11                       ` Miklos Szeredi
2021-05-31 18:12                         ` Amir Goldstein
2021-06-01 14:49                           ` Vivek Goyal
2021-06-01 15:42                             ` Amir Goldstein
2021-06-01 16:08                               ` Max Reitz
2021-06-01 18:23                                 ` Amir Goldstein
2022-09-11 10:14                 ` Persistent FUSE file handles (Was: virtiofs uuid and file handles) Amir Goldstein
2022-09-11 15:16                   ` Bernd Schubert
2022-09-11 15:29                     ` Amir Goldstein [this message]
2022-09-11 15:55                       ` Bernd Schubert
2022-09-12 13:16                   ` Vivek Goyal
2022-09-12 13:38                     ` Amir Goldstein
2022-09-12 14:35                       ` Vivek Goyal
2022-09-12 15:07                         ` Amir Goldstein
2022-09-12 19:56                           ` Vivek Goyal
2022-09-13  2:07                             ` Amir Goldstein
     [not found]           ` <20200922212534.GH57620@redhat.com>
     [not found]             ` <CAOQ4uxjp6NpF_Q0QqUTzE5=YiKz9w6JbUVyROG+rNFcHPAThFg@mail.gmail.com>
2020-09-23 12:53               ` Copying overlayfs directories with index=on Pavel Tikhomirov

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='CAOQ4uxiffF6FKs_My0qxgCnPeeXKSpvzp0-iyjxno=H=Hrn-3g@mail.gmail.com' \
    --to=amir73il@gmail.com \
    --cc=bernd.schubert@fastmail.fm \
    --cc=hreitz@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=vgoyal@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.