linux/fs/nfs/super.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  linux/fs/nfs/super.c
 *
 *  Copyright (C) 1992  Rick Sladkey
 *
 *  nfs superblock handling functions
 *
 *  Modularised by Alan Cox <[email protected]>, while hacking some
 *  experimental NFS changes. Modularisation taken straight from SYS5 fs.
 *
 *  Change to nfs_read_super() to permit NFS mounts to multi-homed hosts.
 *  [email protected]
 *
 *  Split from inode.c by David Howells <[email protected]>
 *
 * - superblocks are indexed on server only - all inodes, dentries, etc. associated with a
 *   particular server are held in the same superblock
 * - NFS superblocks can have several effective roots to the dentry tree
 * - directory type roots are spliced into the tree when a path from one root reaches the root
 *   of another (see nfs_lookup())
 */

#include <linux/module.h>
#include <linux/init.h>

#include <linux/time.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/unistd.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/addr.h>
#include <linux/sunrpc/stats.h>
#include <linux/sunrpc/metrics.h>
#include <linux/sunrpc/xprtsock.h>
#include <linux/sunrpc/xprtrdma.h>
#include <linux/nfs_fs.h>
#include <linux/nfs_mount.h>
#include <linux/nfs4_mount.h>
#include <linux/lockd/bind.h>
#include <linux/seq_file.h>
#include <linux/mount.h>
#include <linux/namei.h>
#include <linux/vfs.h>
#include <linux/inet.h>
#include <linux/in6.h>
#include <linux/slab.h>
#include <net/ipv6.h>
#include <linux/netdevice.h>
#include <linux/nfs_xdr.h>
#include <linux/magic.h>
#include <linux/parser.h>
#include <linux/nsproxy.h>
#include <linux/rcupdate.h>

#include <linux/uaccess.h>
#include <linux/nfs_ssc.h>

#include <uapi/linux/tls.h>

#include "nfs4_fs.h"
#include "callback.h"
#include "delegation.h"
#include "iostat.h"
#include "internal.h"
#include "fscache.h"
#include "nfs4session.h"
#include "pnfs.h"
#include "nfs.h"
#include "netns.h"
#include "sysfs.h"

#define NFSDBG_FACILITY

const struct super_operations nfs_sops =;
EXPORT_SYMBOL_GPL();

#ifdef CONFIG_NFS_V4_2
static const struct nfs_ssc_client_ops nfs_ssc_clnt_ops_tbl =;
#endif

#if IS_ENABLED(CONFIG_NFS_V4)
static int __init register_nfs4_fs(void)
{}

static void unregister_nfs4_fs(void)
{}
#else
static int __init register_nfs4_fs(void)
{
	return 0;
}

static void unregister_nfs4_fs(void)
{
}
#endif

#ifdef CONFIG_NFS_V4_2
static void nfs_ssc_register_ops(void)
{}

static void nfs_ssc_unregister_ops(void)
{}
#endif /* CONFIG_NFS_V4_2 */

static struct shrinker *acl_shrinker;

/*
 * Register the NFS filesystems
 */
int __init register_nfs_fs(void)
{}

/*
 * Unregister the NFS filesystems
 */
void __exit unregister_nfs_fs(void)
{}

bool nfs_sb_active(struct super_block *sb)
{}
EXPORT_SYMBOL_GPL();

void nfs_sb_deactive(struct super_block *sb)
{}
EXPORT_SYMBOL_GPL();

static int __nfs_list_for_each_server(struct list_head *head,
		int (*fn)(struct nfs_server *, void *),
		void *data)
{}

int nfs_client_for_each_server(struct nfs_client *clp,
		int (*fn)(struct nfs_server *, void *),
		void *data)
{}
EXPORT_SYMBOL_GPL();

/*
 * Deliver file system statistics to userspace
 */
int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
{}
EXPORT_SYMBOL_GPL();

/*
 * Map the security flavour number to a name
 */
static const char *nfs_pseudoflavour_to_name(rpc_authflavor_t flavour)
{}

static void nfs_show_mountd_netid(struct seq_file *m, struct nfs_server *nfss,
				  int showdefaults)
{}

static void nfs_show_mountd_options(struct seq_file *m, struct nfs_server *nfss,
				    int showdefaults)
{}

#if IS_ENABLED(CONFIG_NFS_V4)
static void nfs_show_nfsv4_options(struct seq_file *m, struct nfs_server *nfss,
				    int showdefaults)
{}
#else
static void nfs_show_nfsv4_options(struct seq_file *m, struct nfs_server *nfss,
				    int showdefaults)
{
}
#endif

static void nfs_show_nfs_version(struct seq_file *m,
		unsigned int version,
		unsigned int minorversion)
{}

/*
 * Describe the mount options in force on this server representation
 */
static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
				   int showdefaults)
{}

/*
 * Describe the mount options on this VFS mountpoint
 */
int nfs_show_options(struct seq_file *m, struct dentry *root)
{}
EXPORT_SYMBOL_GPL();

#if IS_ENABLED(CONFIG_NFS_V4)
static void show_lease(struct seq_file *m, struct nfs_server *server)
{}
#ifdef CONFIG_NFS_V4_1
static void show_sessions(struct seq_file *m, struct nfs_server *server)
{}
#else
static void show_sessions(struct seq_file *m, struct nfs_server *server) {}
#endif
#endif

#ifdef CONFIG_NFS_V4_1
static void show_pnfs(struct seq_file *m, struct nfs_server *server)
{}

static void show_implementation_id(struct seq_file *m, struct nfs_server *nfss)
{}
#else
#if IS_ENABLED(CONFIG_NFS_V4)
static void show_pnfs(struct seq_file *m, struct nfs_server *server)
{
}
#endif
static void show_implementation_id(struct seq_file *m, struct nfs_server *nfss)
{
}
#endif

int nfs_show_devname(struct seq_file *m, struct dentry *root)
{}
EXPORT_SYMBOL_GPL();

int nfs_show_path(struct seq_file *m, struct dentry *dentry)
{}
EXPORT_SYMBOL_GPL();

/*
 * Present statistical information for this VFS mountpoint
 */
int nfs_show_stats(struct seq_file *m, struct dentry *root)
{}
EXPORT_SYMBOL_GPL();

/*
 * Begin unmount by attempting to remove all automounted mountpoints we added
 * in response to xdev traversals and referrals
 */
void nfs_umount_begin(struct super_block *sb)
{}
EXPORT_SYMBOL_GPL();

/*
 * Return true if 'match' is in auth_info or auth_info is empty.
 * Return false otherwise.
 */
bool nfs_auth_info_match(const struct nfs_auth_info *auth_info,
			 rpc_authflavor_t match)
{}
EXPORT_SYMBOL_GPL();

/*
 * Ensure that a specified authtype in ctx->auth_info is supported by
 * the server. Returns 0 and sets ctx->selected_flavor if it's ok, and
 * -EACCES if not.
 */
static int nfs_verify_authflavors(struct nfs_fs_context *ctx,
				  rpc_authflavor_t *server_authlist,
				  unsigned int count)
{}

/*
 * Use the remote server's MOUNT service to request the NFS file handle
 * corresponding to the provided path.
 */
static int nfs_request_mount(struct fs_context *fc,
			     struct nfs_fh *root_fh,
			     rpc_authflavor_t *server_authlist,
			     unsigned int *server_authlist_len)
{}

static struct nfs_server *nfs_try_mount_request(struct fs_context *fc)
{}

int nfs_try_get_tree(struct fs_context *fc)
{}
EXPORT_SYMBOL_GPL();


#define NFS_REMOUNT_CMP_FLAGMASK

#define NFS_MOUNT_CMP_FLAGMASK

static int
nfs_compare_remount_data(struct nfs_server *nfss,
			 struct nfs_fs_context *ctx)
{}

int nfs_reconfigure(struct fs_context *fc)
{}
EXPORT_SYMBOL_GPL();

/*
 * Finish setting up an NFS superblock
 */
static void nfs_fill_super(struct super_block *sb, struct nfs_fs_context *ctx)
{}

static int nfs_compare_mount_options(const struct super_block *s, const struct nfs_server *b,
				     const struct fs_context *fc)
{}

static int nfs_set_super(struct super_block *s, struct fs_context *fc)
{}

static int nfs_compare_super_address(struct nfs_server *server1,
				     struct nfs_server *server2)
{}

static int nfs_compare_userns(const struct nfs_server *old,
		const struct nfs_server *new)
{}

static int nfs_compare_super(struct super_block *sb, struct fs_context *fc)
{}

#ifdef CONFIG_NFS_FSCACHE
static int nfs_get_cache_cookie(struct super_block *sb,
				struct nfs_fs_context *ctx)
{}
#else
static int nfs_get_cache_cookie(struct super_block *sb,
				struct nfs_fs_context *ctx)
{
	return 0;
}
#endif

int nfs_get_tree_common(struct fs_context *fc)
{}

/*
 * Destroy an NFS superblock
 */
void nfs_kill_super(struct super_block *s)
{}
EXPORT_SYMBOL_GPL();

#if IS_ENABLED(CONFIG_NFS_V4)

/*
 * NFS v4 module parameters need to stay in the
 * NFS client for backwards compatibility
 */
unsigned int nfs_callback_set_tcpport;
unsigned short nfs_callback_nr_threads;
/* Default cache timeout is 10 minutes */
unsigned int nfs_idmap_cache_timeout =;
/* Turn off NFSv4 uid/gid mapping when using AUTH_SYS */
bool nfs4_disable_idmapping =;
unsigned short max_session_slots =;
unsigned short max_session_cb_slots =;
unsigned short send_implementation_id =;
char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN] =;
bool recover_lost_locks =;
short nfs_delay_retrans =;

EXPORT_SYMBOL_GPL();
EXPORT_SYMBOL_GPL();
EXPORT_SYMBOL_GPL();
EXPORT_SYMBOL_GPL();
EXPORT_SYMBOL_GPL();
EXPORT_SYMBOL_GPL();
EXPORT_SYMBOL_GPL();
EXPORT_SYMBOL_GPL();
EXPORT_SYMBOL_GPL();
EXPORT_SYMBOL_GPL();

#define NFS_CALLBACK_MAXPORTNR

static int param_set_portnr(const char *val, const struct kernel_param *kp)
{}
static const struct kernel_param_ops param_ops_portnr =;
#define param_check_portnr(name, p)

module_param_named(callback_tcpport, nfs_callback_set_tcpport, portnr, 0644);
module_param_named(callback_nr_threads, nfs_callback_nr_threads, ushort, 0644);
MODULE_PARM_DESC();
module_param(nfs_idmap_cache_timeout, int, 0644);
module_param(nfs4_disable_idmapping, bool, 0644);
module_param_string();
MODULE_PARM_DESC();
module_param(max_session_slots, ushort, 0644);
MODULE_PARM_DESC();
module_param(max_session_cb_slots, ushort, 0644);
MODULE_PARM_DESC();
module_param(send_implementation_id, ushort, 0644);
MODULE_PARM_DESC();
MODULE_PARM_DESC();

module_param(recover_lost_locks, bool, 0644);
MODULE_PARM_DESC();

module_param_named(delay_retrans, nfs_delay_retrans, short, 0644);
MODULE_PARM_DESC();
#endif /* CONFIG_NFS_V4 */