mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-12-31 22:57:14 +01:00
Pull nfsd updates from Chuck Lever:
"Mike Snitzer has prototyped a mechanism for disabling I/O caching in
NFSD. This is introduced in v6.18 as an experimental feature. This
enables scaling NFSD in /both/ directions:
- NFS service can be supported on systems with small memory
footprints, such as low-cost cloud instances
- Large NFS workloads will be less likely to force the eviction of
server-local activity, helping it avoid thrashing
Jeff Layton contributed a number of fixes to the new attribute
delegation implementation (based on a pending Internet RFC) that we
hope will make attribute delegation reliable enough to enable by
default, as it is on the Linux NFS client.
The remaining patches in this pull request are clean-ups and minor
optimizations. Many thanks to the contributors, reviewers, testers,
and bug reporters who participated during the v6.18 NFSD development
cycle"
* tag 'nfsd-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: (42 commits)
nfsd: discard nfserr_dropit
SUNRPC: Make RPCSEC_GSS_KRB5 select CRYPTO instead of depending on it
NFSD: Add io_cache_{read,write} controls to debugfs
NFSD: Do the grace period check in ->proc_layoutget
nfsd: delete unnecessary NULL check in __fh_verify()
NFSD: Allow layoutcommit during grace period
NFSD: Disallow layoutget during grace period
sunrpc: fix "occurence"->"occurrence"
nfsd: Don't force CRYPTO_LIB_SHA256 to be built-in
nfsd: nfserr_jukebox in nlm_fopen should lead to a retry
NFSD: Reduce DRC bucket size
NFSD: Delay adding new entries to LRU
SUNRPC: Move the svc_rpcb_cleanup() call sites
NFS: Remove rpcbind cleanup for NFSv4.0 callback
nfsd: unregister with rpcbind when deleting a transport
NFSD: Drop redundant conversion to bool
sunrpc: eliminate return pointer in svc_tcp_sendmsg()
sunrpc: fix pr_notice in svc_tcp_sendto() to show correct length
nfsd: decouple the xprtsec policy check from check_nfsd_access()
NFSD: Fix destination buffer size in nfsd4_ssc_setup_dul()
...
124 lines
3.5 KiB
C
124 lines
3.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (C) 2024 Mike Snitzer <snitzer@hammerspace.com>
|
|
* Copyright (C) 2024 NeilBrown <neilb@suse.de>
|
|
*/
|
|
#ifndef __LINUX_NFSLOCALIO_H
|
|
#define __LINUX_NFSLOCALIO_H
|
|
|
|
#if IS_ENABLED(CONFIG_NFS_LOCALIO)
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/list.h>
|
|
#include <linux/uuid.h>
|
|
#include <linux/sunrpc/clnt.h>
|
|
#include <linux/sunrpc/svcauth.h>
|
|
#include <linux/nfs.h>
|
|
#include <net/net_namespace.h>
|
|
|
|
struct nfs_client;
|
|
struct nfs_file_localio;
|
|
|
|
/*
|
|
* Useful to allow a client to negotiate if localio
|
|
* possible with its server.
|
|
*
|
|
* See Documentation/filesystems/nfs/localio.rst for more detail.
|
|
*/
|
|
typedef struct {
|
|
uuid_t uuid;
|
|
unsigned nfs3_localio_probe_count;
|
|
/* this struct is over a cacheline, avoid bouncing */
|
|
spinlock_t ____cacheline_aligned lock;
|
|
struct list_head list;
|
|
spinlock_t *list_lock; /* nn->local_clients_lock */
|
|
struct net __rcu *net; /* nfsd's network namespace */
|
|
struct auth_domain *dom; /* auth_domain for localio */
|
|
/* Local files to close when net is shut down or exports change */
|
|
struct list_head files;
|
|
} nfs_uuid_t;
|
|
|
|
void nfs_uuid_init(nfs_uuid_t *);
|
|
bool nfs_uuid_begin(nfs_uuid_t *);
|
|
void nfs_uuid_end(nfs_uuid_t *);
|
|
void nfs_uuid_is_local(const uuid_t *, struct list_head *, spinlock_t *,
|
|
struct net *, struct auth_domain *, struct module *);
|
|
|
|
void nfs_localio_enable_client(struct nfs_client *clp);
|
|
void nfs_localio_disable_client(struct nfs_client *clp);
|
|
void nfs_localio_invalidate_clients(struct list_head *nn_local_clients,
|
|
spinlock_t *nn_local_clients_lock);
|
|
|
|
/* localio needs to map filehandle -> struct nfsd_file */
|
|
void nfs_close_local_fh(struct nfs_file_localio *);
|
|
|
|
struct nfsd_localio_operations {
|
|
bool (*nfsd_net_try_get)(struct net *);
|
|
void (*nfsd_net_put)(struct net *);
|
|
struct nfsd_file *(*nfsd_open_local_fh)(struct net *,
|
|
struct auth_domain *,
|
|
struct rpc_clnt *,
|
|
const struct cred *,
|
|
const struct nfs_fh *,
|
|
struct nfsd_file __rcu **pnf,
|
|
const fmode_t);
|
|
struct net *(*nfsd_file_put_local)(struct nfsd_file __rcu **);
|
|
struct file *(*nfsd_file_file)(struct nfsd_file *);
|
|
void (*nfsd_file_dio_alignment)(struct nfsd_file *,
|
|
u32 *, u32 *, u32 *);
|
|
} ____cacheline_aligned;
|
|
|
|
extern void nfsd_localio_ops_init(void);
|
|
extern const struct nfsd_localio_operations *nfs_to;
|
|
|
|
struct nfsd_file *nfs_open_local_fh(nfs_uuid_t *,
|
|
struct rpc_clnt *, const struct cred *,
|
|
const struct nfs_fh *, struct nfs_file_localio *,
|
|
struct nfsd_file __rcu **pnf,
|
|
const fmode_t);
|
|
|
|
static inline void nfs_to_nfsd_net_put(struct net *net)
|
|
{
|
|
/*
|
|
* Once reference to net (and associated nfsd_serv) is dropped, NFSD
|
|
* could be unloaded, so ensure safe return from nfsd_net_put() by
|
|
* always taking RCU.
|
|
*/
|
|
rcu_read_lock();
|
|
nfs_to->nfsd_net_put(net);
|
|
rcu_read_unlock();
|
|
}
|
|
|
|
static inline void nfs_to_nfsd_file_put_local(struct nfsd_file __rcu **localio)
|
|
{
|
|
/*
|
|
* Either *localio must be guaranteed to be non-NULL, or caller
|
|
* must prevent nfsd shutdown from completing as nfs_close_local_fh()
|
|
* does by blocking the nfs_uuid from being finally put.
|
|
*/
|
|
struct net *net;
|
|
|
|
net = nfs_to->nfsd_file_put_local(localio);
|
|
|
|
if (net)
|
|
nfs_to_nfsd_net_put(net);
|
|
}
|
|
|
|
#else /* CONFIG_NFS_LOCALIO */
|
|
|
|
struct nfs_file_localio;
|
|
static inline void nfs_close_local_fh(struct nfs_file_localio *nfl)
|
|
{
|
|
}
|
|
static inline void nfsd_localio_ops_init(void)
|
|
{
|
|
}
|
|
struct nfs_client;
|
|
static inline void nfs_localio_disable_client(struct nfs_client *clp)
|
|
{
|
|
}
|
|
|
|
#endif /* CONFIG_NFS_LOCALIO */
|
|
|
|
#endif /* __LINUX_NFSLOCALIO_H */
|