From: Mike Snitzer <snitzer@kernel.org>
To: NeilBrown <neilb@suse.de>
Cc: Jeff Layton <jlayton@kernel.org>,
linux-nfs@vger.kernel.org, Chuck Lever <chuck.lever@oracle.com>,
Trond Myklebust <trondmy@hammerspace.com>,
snitzer@hammerspace.com
Subject: Re: [for-6.11 PATCH 10/29] nfs/nfsd: add "local io" support
Date: Wed, 12 Jun 2024 00:48:25 -0400 [thread overview]
Message-ID: <ZmkomfPEA2ETa8kt@kernel.org> (raw)
In-Reply-To: <171816536144.14261.4040713092050012288@noble.neil.brown.name>
On Wed, Jun 12, 2024 at 02:09:21PM +1000, NeilBrown wrote:
> On Wed, 12 Jun 2024, Mike Snitzer wrote:
> > On Wed, Jun 12, 2024 at 01:17:05PM +1000, NeilBrown wrote:
> > > On Wed, 12 Jun 2024, Mike Snitzer wrote:
> > > >
> > > > SO I looked, and I'm saddened to see Neil's 6.8 commit 1e3577a4521e
> > > > ("SUNRPC: discard sv_refcnt, and svc_get/svc_put").
> > > >
> > > > [the lack of useful refcounting with the current code kind of blew me
> > > > away.. but nice to see it existed not too long ago.]
> > > >
> > > > Rather than immediately invest the effort to revert commit
> > > > 1e3577a4521e for my apparent needs... I'll send out v2 to allow for
> > > > further review and discussion.
> > > >
> > > > But it really does feel like I _need_ svc_{get,put} and nfsd_{get,put}
> > >
> > > You are taking a reference, and at the right time. But it is to the
> > > wrong thing.
> >
> > Well, that reference is to ensure nfsd (and nfsd_open_local_fh) is
> > available for the duration of a local client connected to it.
> >
> > Really wasn't trying to keep nn->nfsd_serv around with this ;)
> >
> > > You call symbol_request(nfsd_open_local_fh) and so get a reference to
> > > the nfsd module. But you really want a reference to the nfsd service.
> > >
> > > I would suggest that you use symbol_request() to get a function which
> > > you then call and immediately symbol_put().... unless you need to use it
> > > to discard the reference to the service later.
> >
> > Getting the nfsd_open_local_fh symbol once when client handshakes with
> > server is meant to avoid needing to do so for every IO the client
> > issues to the local server.
> >
> > > The function would take nfsd_mutex, check there is an nfsd_serv, sets a
> > > flag or whatever to indicate the serv is being used for local_io, and
> > > maybe returns the nfsd_serv. As long as that flag is set the serv
> > > cannot be destroy.
> > >
> > > Do you need there to be available threads for LOCAL_IO to work? If so
> > > the flag would cause setting the num threads to zero to fail.
> > > If not .... that is weird. It would mean that setting the number of
> > > threads to zero would not destroy the service and I don't think we want
> > > to do that.
> > >
> > > So I think that when LOCAL_IO is in use, setting number of threads to
> > > zero must return EBUSY or similar, even if you don't need the threads.
> >
> > Yes, but I really dislike needing to play games with a tangential
> > characteristic of nfsd_serv (that threads are what hold reference),
> > rather than have the ability to keep the nfsd_serv around in a cleaner
> > way.
> >
> > This localio code doesn't run in nfsd context so it isn't using nfsd's
> > threads. Forcing threads to be held in reserve because localio doesn't
> > want nfsd_serv to go away isn't ideal.
>
> I started reading the rest of the patches and it seems that localio is
> only used for READ, WRTE, COMMIT. Is that correct? Is there
> documentation so that I don't have to ask?
The header for v2's patch 7 (nfs/nfsd: add "localio" support) starts with:
Add client support for bypassing NFS for localhost reads, writes, and
commits.
But I should've made it clearer by saying the same in the 0th header.
> Obviously there are lots of other NFS requests so you wouldn't be able
> to use localio without nfsd threads running....
That's very true.
> But a normal remote client doesn't pin the nfsd threads or the
> nfsd_serv. If the threads go away, the client blocks until the service
> comes back. Would that be appropriate semantics for localio?? i.e. on
> each nfsd_open_local_fh() call you mutex_trylock and hold that long
> enough to get the 'struct file *'. If it fails because there is no
> serv, you simply fall-back to the same path you use for other requests.
>
> Could that work?
I can try it, but feels like it'd elevate nfsd_mutex to "contended",
as such it feels heavy.
> > Does it maybe make sense to introduce a more narrow svc_get/svc_put
> > for this auxillary usecase?
>
> I don't think so. nfsd is a self-contained transactional service. It
> doesn't promise to persist beyond each transaction.
> Current transactions return status and/or data. Adding a new transaction
> that returns a 'struct file *' fits that model reasonable well.
Sure. But to be clear, I am adding global state to nfs_common that
tracks nfsd_uuids. Those change every time a new nfsd_net is created
for a given server (client will then lookup the uuid to see if local).
But even if we went to the extreme where nfsd instances are bouncing
like crazy, the 'nfsd_uuids' list in nfs_common should work fine.
Just not seeing what is gained by nfsd being so ephemeral. Maybe your
point is, it should work in that model too?.. I think it would, just
less efficiently due to make-work to re-get resources it needs.
> Taking an external reference to the nfs service is quite a big
> conceptual change.
Getting the nfsd_open_local_fh() symbol in a coarse-grained manner
isn't about anything other than efficiency. Ensures localio client
calls to nfsd_open_local_fh will work for as long as it exists on that
local server -- nfs.ko's indirect reference to nfsd.ko (via
nfs_localio.ko getting symbol for nfsd_open_local_fh) is dropped when
client is destroyed.
Mike
next prev parent reply other threads:[~2024-06-12 4:48 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 14:26 [for-6.11 PATCH 00/29] nfs/nfsd: add support for localio bypass Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 01/29] nfs: pass nfs_client to nfs_initiate_pgio Mike Snitzer
2024-06-10 12:02 ` Jeff Layton
2024-06-07 14:26 ` [for-6.11 PATCH 02/29] nfs: pass nfs_client to nfs_initiate_commit Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 03/29] nfs: pass descriptor thru nfs_initiate_pgio path Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 04/29] sunrpc: handle NULL req->defer in cache_defer_req Mike Snitzer
2024-06-10 12:21 ` Jeff Layton
2024-06-11 1:03 ` NeilBrown
2024-06-11 2:57 ` Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 05/29] sunrpc: export svc_defer Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 06/29] sunrpc: add rpcauth_map_to_svc_cred Mike Snitzer
2024-06-10 12:19 ` Jeff Layton
2024-06-07 14:26 ` [for-6.11 PATCH 07/29] sunrpc: add and export rpc_ntop6_addr_noscopeid Mike Snitzer
2024-06-09 12:36 ` Jeff Layton
2024-06-10 16:33 ` Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 08/29] nfs: move nfs_stat_to_errno to nfs.h Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 09/29] NFS: Manage boot verifier correctly in the case of localio Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 10/29] nfs/nfsd: add "local io" support Mike Snitzer
2024-06-10 12:43 ` Jeff Layton
2024-06-10 16:42 ` Mike Snitzer
2024-06-12 2:25 ` Mike Snitzer
2024-06-12 3:17 ` NeilBrown
2024-06-12 3:41 ` Mike Snitzer
2024-06-12 4:09 ` NeilBrown
2024-06-12 4:48 ` Mike Snitzer [this message]
2024-06-12 6:30 ` NeilBrown
2024-06-07 14:26 ` [for-6.11 PATCH 11/29] NFS: Enable localio for non-pNFS I/O Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 12/29] nfs/flexfiles: check local DS when making DS connections Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 13/29] pnfs/flexfiles: Enable localio for flexfiles I/O Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 14/29] NFS: Add tracepoints for nfs_local_enable and nfs_local_disable Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 15/29] NFS: Don't call filesystem write() routines directly Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 16/29] NFS: Don't call filesystem read() " Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 17/29] NFS: Use completion rather than flush_work() in nfs_local_commit() Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 18/29] NFS: localio writes need to use a normal workqueue Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 19/29] nfs/write: fix nfs_initiate_commit to return error from nfs_local_commit Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 20/29] nfs/localio: discontinue network address based localio setup Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 21/29] nfs_common: add NFS v3 LOCALIO protocol extension enablement Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 22/29] nfs: implement v3 client support for NFS_LOCALIO_PROGRAM Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 23/29] nfsd: implement v3 server " Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 24/29] nfs_common: add NFS v4 LOCALIO protocol extension enablement Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 25/29] nfs: implement v4 client support for NFS_LOCALIO_PROGRAM Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 26/29] nfsd: implement v4 server " Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 27/29] nfs/nfsd: switch GETUUID to using {encode,decode}_opaque_fixed Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 28/29] nfs/nfsd: consolidate {encode,decode}_opaque_fixed in nfs_xdr.h Mike Snitzer
2024-06-07 14:26 ` [for-6.11 PATCH 29/29] nfs/localio: move managing nfsd_open_local_fh symbol to nfs_common Mike Snitzer
2024-06-07 18:06 ` [for-6.11 PATCH 30/29] nfs/nfsd: ensure localio server always uses its network namespace Mike Snitzer
2024-06-09 15:44 ` Chuck Lever
2024-06-10 16:50 ` Mike Snitzer
2024-06-10 22:37 ` Mike Snitzer
2024-06-07 18:09 ` [for-6.11 PATCH 00/29] nfs/nfsd: add support for localio bypass Mike Snitzer
2024-06-10 12:47 ` Jeff Layton
2024-06-10 16:47 ` Mike Snitzer
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=ZmkomfPEA2ETa8kt@kernel.org \
--to=snitzer@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=snitzer@hammerspace.com \
--cc=trondmy@hammerspace.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