#include <linux/fs_struct.h>
#include <linux/file.h>
#include <linux/falloc.h>
#include <linux/slab.h>
#include <linux/kthread.h>
#include <linux/namei.h>
#include <linux/sunrpc/addr.h>
#include <linux/nfs_ssc.h>
#include "idmap.h"
#include "cache.h"
#include "xdr4.h"
#include "vfs.h"
#include "current_stateid.h"
#include "netns.h"
#include "acl.h"
#include "pnfs.h"
#include "trace.h"
static bool inter_copy_offload_enable;
module_param(inter_copy_offload_enable, bool, 0644);
MODULE_PARM_DESC(…) …;
#ifdef CONFIG_NFSD_V4_2_INTER_SSC
static int nfsd4_ssc_umount_timeout = …;
module_param(nfsd4_ssc_umount_timeout, int, 0644);
MODULE_PARM_DESC(…) …;
#endif
#define NFSDDBG_FACILITY …
static u32 nfsd_attrmask[] = …;
static u32 nfsd41_ex_attrmask[] = …;
static __be32
check_attr_support(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
u32 *bmval, u32 *writable)
{ … }
static __be32
nfsd4_check_open_attributes(struct svc_rqst *rqstp,
struct nfsd4_compound_state *cstate, struct nfsd4_open *open)
{ … }
static int
is_create_with_attrs(struct nfsd4_open *open)
{ … }
static inline void
fh_dup2(struct svc_fh *dst, struct svc_fh *src)
{ … }
static __be32
do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode)
{ … }
static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)
{ … }
static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh *resfh)
{ … }
static inline bool nfsd4_create_is_exclusive(int createmode)
{ … }
static __be32
nfsd4_vfs_create(struct svc_fh *fhp, struct dentry *child,
struct nfsd4_open *open)
{ … }
static __be32
nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp,
struct svc_fh *resfhp, struct nfsd4_open *open)
{ … }
static void
set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
{ … }
static __be32
do_open_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh **resfh)
{ … }
static __be32
do_open_fhandle(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open)
{ … }
static void
copy_clientid(clientid_t *clid, struct nfsd4_session *session)
{ … }
static __be32
nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32 nfsd4_open_omfg(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_op *op)
{ … }
static __be32
nfsd4_getfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_putfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_restorefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_savefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_access(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static void gen_boot_verifier(nfs4_verifier *verifier, struct net *net)
{ … }
static __be32
nfsd4_commit(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_link(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32 nfsd4_do_lookupp(struct svc_rqst *rqstp, struct svc_fh *fh)
{ … }
static __be32
nfsd4_lookupp(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static void
nfsd4_read_release(union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_readdir(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_readlink(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_remove(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_secinfo(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_secinfo_no_name(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static void
nfsd4_secinfo_release(union nfsd4_op_u *u)
{ … }
static void
nfsd4_secinfo_no_name_release(union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_verify_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
stateid_t *src_stateid, struct nfsd_file **src,
stateid_t *dst_stateid, struct nfsd_file **dst)
{ … }
static __be32
nfsd4_clone(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static void nfs4_put_copy(struct nfsd4_copy *copy)
{ … }
static void nfsd4_stop_copy(struct nfsd4_copy *copy)
{ … }
static struct nfsd4_copy *nfsd4_get_copy(struct nfs4_client *clp)
{ … }
void nfsd4_shutdown_copy(struct nfs4_client *clp)
{ … }
#ifdef CONFIG_NFSD_V4_2_INTER_SSC
extern struct file *nfs42_ssc_open(struct vfsmount *ss_mnt,
struct nfs_fh *src_fh,
nfs4_stateid *stateid);
extern void nfs42_ssc_close(struct file *filep);
extern void nfs_sb_deactive(struct super_block *sb);
#define NFSD42_INTERSSC_MOUNTOPS …
static __be32 nfsd4_ssc_setup_dul(struct nfsd_net *nn, char *ipaddr,
struct nfsd4_ssc_umount_item **nsui,
struct svc_rqst *rqstp)
{ … }
static void nfsd4_ssc_update_dul(struct nfsd_net *nn,
struct nfsd4_ssc_umount_item *nsui,
struct vfsmount *ss_mnt)
{ … }
static void nfsd4_ssc_cancel_dul(struct nfsd_net *nn,
struct nfsd4_ssc_umount_item *nsui)
{ … }
static __be32
nfsd4_interssc_connect(struct nl4_server *nss, struct svc_rqst *rqstp,
struct nfsd4_ssc_umount_item **nsui)
{ … }
static __be32
nfsd4_setup_inter_ssc(struct svc_rqst *rqstp,
struct nfsd4_compound_state *cstate,
struct nfsd4_copy *copy)
{ … }
static void
nfsd4_cleanup_inter_ssc(struct nfsd4_ssc_umount_item *nsui, struct file *filp,
struct nfsd_file *dst)
{ … }
#else
static __be32
nfsd4_setup_inter_ssc(struct svc_rqst *rqstp,
struct nfsd4_compound_state *cstate,
struct nfsd4_copy *copy)
{
return nfserr_inval;
}
static void
nfsd4_cleanup_inter_ssc(struct nfsd4_ssc_umount_item *nsui, struct file *filp,
struct nfsd_file *dst)
{
}
static struct file *nfs42_ssc_open(struct vfsmount *ss_mnt,
struct nfs_fh *src_fh,
nfs4_stateid *stateid)
{
return NULL;
}
#endif
static __be32
nfsd4_setup_intra_ssc(struct svc_rqst *rqstp,
struct nfsd4_compound_state *cstate,
struct nfsd4_copy *copy)
{ … }
static void nfsd4_cb_offload_release(struct nfsd4_callback *cb)
{ … }
static int nfsd4_cb_offload_done(struct nfsd4_callback *cb,
struct rpc_task *task)
{ … }
static const struct nfsd4_callback_ops nfsd4_cb_offload_ops = …;
static void nfsd4_init_copy_res(struct nfsd4_copy *copy, bool sync)
{ … }
static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy,
struct file *dst,
struct file *src)
{ … }
static __be32 nfsd4_do_copy(struct nfsd4_copy *copy,
struct file *src, struct file *dst,
bool sync)
{ … }
static void dup_copy_fields(struct nfsd4_copy *src, struct nfsd4_copy *dst)
{ … }
static void release_copy_files(struct nfsd4_copy *copy)
{ … }
static void cleanup_async_copy(struct nfsd4_copy *copy)
{ … }
static void nfsd4_send_cb_offload(struct nfsd4_copy *copy)
{ … }
static int nfsd4_do_async_copy(void *data)
{ … }
static __be32
nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static struct nfsd4_copy *
find_async_copy_locked(struct nfs4_client *clp, stateid_t *stateid)
{ … }
static struct nfsd4_copy *
find_async_copy(struct nfs4_client *clp, stateid_t *stateid)
{ … }
static __be32
nfsd4_offload_cancel(struct svc_rqst *rqstp,
struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_copy_notify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_fallocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
struct nfsd4_fallocate *fallocate, int flags)
{ … }
static __be32
nfsd4_offload_status(struct svc_rqst *rqstp,
struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_allocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_deallocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_seek(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
_nfsd4_verify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
struct nfsd4_verify *verify)
{ … }
static __be32
nfsd4_nverify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_verify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_get_dir_delegation(struct svc_rqst *rqstp,
struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
#ifdef CONFIG_NFSD_PNFS
static const struct nfsd4_layout_ops *
nfsd4_layout_verify(struct svc_export *exp, unsigned int layout_type)
{ … }
static __be32
nfsd4_getdeviceinfo(struct svc_rqst *rqstp,
struct nfsd4_compound_state *cstate, union nfsd4_op_u *u)
{ … }
static void
nfsd4_getdeviceinfo_release(union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_layoutget(struct svc_rqst *rqstp,
struct nfsd4_compound_state *cstate, union nfsd4_op_u *u)
{ … }
static void
nfsd4_layoutget_release(union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_layoutcommit(struct svc_rqst *rqstp,
struct nfsd4_compound_state *cstate, union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_layoutreturn(struct svc_rqst *rqstp,
struct nfsd4_compound_state *cstate, union nfsd4_op_u *u)
{ … }
#endif
static __be32
nfsd4_getxattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_setxattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_listxattrs(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_removexattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{ … }
static __be32
nfsd4_proc_null(struct svc_rqst *rqstp)
{ … }
static inline void nfsd4_increment_op_stats(struct nfsd_net *nn, u32 opnum)
{ … }
static const struct nfsd4_operation nfsd4_ops[];
static const char *nfsd4_op_name(unsigned opnum);
static __be32 nfs41_check_op_ordering(struct nfsd4_compoundargs *args)
{ … }
const struct nfsd4_operation *OPDESC(struct nfsd4_op *op)
{ … }
bool nfsd4_cache_this_op(struct nfsd4_op *op)
{ … }
static bool need_wrongsec_check(struct svc_rqst *rqstp)
{ … }
#ifdef CONFIG_NFSD_V4_2_INTER_SSC
static void
check_if_stalefh_allowed(struct nfsd4_compoundargs *args)
{ … }
#else
static void
check_if_stalefh_allowed(struct nfsd4_compoundargs *args)
{
}
#endif
static __be32
nfsd4_proc_compound(struct svc_rqst *rqstp)
{ … }
#define op_encode_hdr_size …
#define op_encode_stateid_maxsz …
#define op_encode_verifier_maxsz …
#define op_encode_change_info_maxsz …
#define nfs4_fattr_bitmap_maxsz …
#define op_encode_lockowner_maxsz …
#define op_encode_lock_denied_maxsz …
#define nfs4_owner_maxsz …
#define op_encode_ace_maxsz …
#define op_encode_delegation_maxsz …
#define op_encode_channel_attrs_maxsz …
static u32 nfsd4_max_payload(const struct svc_rqst *rqstp)
{ … }
static u32 nfsd4_only_status_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_status_stateid_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_access_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_commit_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_create_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_getattr_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_getfh_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_link_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_lock_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_open_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_read_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_read_plus_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_readdir_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_readlink_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_remove_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_rename_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_sequence_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_test_stateid_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_setattr_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_secinfo_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_setclientid_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_write_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_exchange_id_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_bind_conn_to_session_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_create_session_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_copy_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_offload_status_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_copy_notify_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_get_dir_delegation_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
#ifdef CONFIG_NFSD_PNFS
static u32 nfsd4_getdeviceinfo_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
#define MAX_LAYOUT_SIZE …
static u32 nfsd4_layoutget_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_layoutcommit_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_layoutreturn_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
#endif
static u32 nfsd4_seek_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_getxattr_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_setxattr_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_listxattrs_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static u32 nfsd4_removexattr_rsize(const struct svc_rqst *rqstp,
const struct nfsd4_op *op)
{ … }
static const struct nfsd4_operation nfsd4_ops[] = …;
bool nfsd4_spo_must_allow(struct svc_rqst *rqstp)
{ … }
int nfsd4_max_reply(struct svc_rqst *rqstp, struct nfsd4_op *op)
{ … }
void warn_on_nonidempotent_op(struct nfsd4_op *op)
{ … }
static const char *nfsd4_op_name(unsigned opnum)
{ … }
static const struct svc_procedure nfsd_procedures4[2] = …;
static DEFINE_PER_CPU_ALIGNED(unsigned long,
nfsd_count4[ARRAY_SIZE(nfsd_procedures4)]);
const struct svc_version nfsd_version4 = …;