From: Jeff Layton <jlayton@kernel.org>
To: NeilBrown <neilb@suse.de>
Cc: Chuck Lever <chuck.lever@oracle.com>,
linux-nfs@vger.kernel.org, Olga Kornievskaia <kolga@netapp.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
Mike Snitzer <snitzer@kernel.org>
Subject: Re: [PATCH 6/6] nfsd: add nfsd_file_acquire_local().
Date: Mon, 01 Jul 2024 20:29:25 -0400 [thread overview]
Message-ID: <062a99d674ea282b317d9e0b457f336810dd5d88.camel@kernel.org> (raw)
In-Reply-To: <171987815216.16071.11700950008759904924@noble.neil.brown.name>
On Tue, 2024-07-02 at 09:55 +1000, NeilBrown wrote:
> On Mon, 01 Jul 2024, Jeff Layton wrote:
> >
> > Neil, in an earlier email you mentioned that the client could hold onto
> > the nfsd_file reference over several operations and then put it. That
> > would be fine too, but I'm unclear on how the client will manage this.
> > Does the client have a way to keep track of the nfsd_file over several
> > operations to the same inode?
>
> Looking at
> [PATCH v10 13/19] nfs: add "localio" support
>
> you can see that
> struct file *local_filp;
> is added to "struct nfs_open_context". An nfs_open_context is stored
> in file->private_data and is attached to the inode via nfsi->open_files.
> It holds the nfs state for any file open on the NFS filesystem..
>
> ->local_filp is set the first time nfs_local_file_open_cache() is called
> and remains set until the final __put_nfs_open_context() call destroys
> the context. So it lasts as long as the NFS file is open. Note that
> only one successful ->nfsd_open_local_fh() call is made for each opened
> NFS file. All IO then uses the "struct file*" with no further reference
> to nfsd.
>
> If we stored an nfsd_file in the nfs_open_context, either as well as
> the 'struct file*' or instead of, then we could call nfsd_file_put()
> when the nfs file is closed. That seems to be the correct lifetime and
> matches (almost) exactly what happens with NFSv4 where OPEN and CLOSE
> are send over the wire.
>
Ok.
> >
> > Even then, I still think we're probably better off just garbage
> > collecting thse, since it seems likely that they will end up being
> > reused in many cases.
>
> Why does this logic apply to localio, but not to normal NFSv4 access?
>
The main idea with the filecache was to keep open files around for a
little while to reduce the open/close overhead between v3 RPCs. The
argument for not caching files with v4 is that we have an open stateid
that pins the open file in place, so we don't need to do that there.
Hanging an nfsd_file off of the nfs client's open_context sounds like a
reasonable alternative.
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2024-07-02 0:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 2:53 [PATCH 0/6 RFC] nfsd: provide simpler interface for LOCALIO access NeilBrown
2024-07-01 2:53 ` [PATCH 1/6] nfsd: introduce __fh_verify which takes explicit nfsd_net arg NeilBrown
2024-07-01 14:54 ` Chuck Lever
2024-07-01 15:46 ` kernel test robot
2024-07-01 2:53 ` [PATCH 2/6] nfsd: add cred parameter to __fh_verify() NeilBrown
2024-07-01 11:02 ` Jeff Layton
2024-07-01 17:34 ` kernel test robot
2024-07-01 2:53 ` [PATCH 3/6] nfsd: pass nfs_vers explicitly " NeilBrown
2024-07-01 14:57 ` Chuck Lever
2024-07-01 19:16 ` kernel test robot
2024-07-01 2:53 ` [PATCH 4/6] nfsd: pass client " NeilBrown
2024-07-01 11:12 ` Jeff Layton
2024-07-01 2:53 ` [PATCH 5/6] nfsd: __fh_verify now treats NULL rqstp as a trusted connection NeilBrown
2024-07-01 2:53 ` [PATCH 6/6] nfsd: add nfsd_file_acquire_local() NeilBrown
2024-07-01 11:21 ` Jeff Layton
2024-07-01 23:55 ` NeilBrown
2024-07-02 0:29 ` Jeff Layton [this message]
2024-07-04 8:58 ` kernel test robot
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=062a99d674ea282b317d9e0b457f336810dd5d88.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=kolga@netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=snitzer@kernel.org \
--cc=tom@talpey.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox