tristate "NFS client support for NFS version 4"
depends on NFS_FS
select KEYS
+ select SUNRPC_BACKCHANNEL
help
- This option enables support for version 4 of the NFS protocol
- (RFC 3530) in the kernel's NFS client.
+ This option enables support for version 4.1 of the NFS protocol
+ (RFC 5661) in the kernel's NFS client.
To mount NFS servers using NFSv4, you also need to install user
space programs which can be found in the Linux nfs-utils package,
If unsure, say N.
-config NFS_V4_1
- bool "NFS client support for NFSv4.1"
- depends on NFS_V4
- select SUNRPC_BACKCHANNEL
- help
- This option enables support for minor version 1 of the NFSv4 protocol
- (RFC 5661) in the kernel's NFS client.
-
- If unsure, say N.
-
config NFS_V4_2
bool "NFS client support for NFSv4.2"
- depends on NFS_V4_1
+ depends on NFS_V4
help
This option enables support for minor version 2 of the NFSv4 protocol
in the kernel's NFS client.
config PNFS_FILE_LAYOUT
tristate
- depends on NFS_V4_1
+ depends on NFS_V4
default NFS_V4
config PNFS_BLOCK
tristate
- depends on NFS_V4_1 && BLK_DEV_DM
+ depends on NFS_V4 && BLK_DEV_DM
default NFS_V4
config PNFS_FLEXFILE_LAYOUT
tristate
- depends on NFS_V4_1
+ depends on NFS_V4
default NFS_V4
config NFS_V4_1_IMPLEMENTATION_ID_DOMAIN
string "NFSv4.1 Implementation ID Domain"
- depends on NFS_V4_1
+ depends on NFS_V4
default "kernel.org"
help
This option defines the domain portion of the implementation ID that
config NFS_V4_1_MIGRATION
bool "NFSv4.1 client support for migration"
- depends on NFS_V4_1
+ depends on NFS_V4
default n
help
This option makes the NFS client advertise to NFSv4.1 servers that
nfsv4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o \
delegation.o nfs4idmap.o callback.o callback_xdr.o callback_proc.o \
nfs4namespace.o nfs4getroot.o nfs4client.o nfs4session.o \
- dns_resolve.o nfs4trace.o
+ dns_resolve.o nfs4trace.o pnfs.o pnfs_dev.o pnfs_nfs.o
nfsv4-$(CONFIG_NFS_USE_LEGACY_DNS) += cache_lib.o
nfsv4-$(CONFIG_SYSCTL) += nfs4sysctl.o
nfsv4-$(CONFIG_NFS_V4_0) += nfs40client.o nfs40proc.o
-nfsv4-$(CONFIG_NFS_V4_1) += pnfs.o pnfs_dev.o pnfs_nfs.o
nfsv4-$(CONFIG_NFS_V4_2) += nfs42proc.o nfs42xattr.o
obj-$(CONFIG_PNFS_FILE_LAYOUT) += filelayout/
return 0;
}
-#if defined(CONFIG_NFS_V4_1)
static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
struct svc_serv *serv)
{
*/
xprt->bc_serv = serv;
}
-#else
-static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
- struct svc_serv *serv)
-{
-}
-#endif /* CONFIG_NFS_V4_1 */
static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,
struct svc_serv *serv)
}
ret = 0;
- if (!IS_ENABLED(CONFIG_NFS_V4_1) || minorversion == 0)
+ if (minorversion == 0)
ret = nfs4_callback_up_net(serv, net);
else if (xprt->ops->bc_setup)
set_bc_enabled(serv);
cb_info->users);
threadfn = nfs4_callback_svc;
-#if !defined(CONFIG_NFS_V4_1)
- if (minorversion)
- return ERR_PTR(-ENOTSUPP);
-#endif
serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE,
threadfn);
if (!serv) {
uint32_t truncate;
};
-#if defined(CONFIG_NFS_V4_1)
-
struct referring_call {
uint32_t rc_sequenceid;
uint32_t rc_slotid;
extern __be32 nfs4_callback_notify_lock(void *argp, void *resp,
struct cb_process_state *cps);
-#endif /* CONFIG_NFS_V4_1 */
#ifdef CONFIG_NFS_V4_2
struct cb_offloadargs {
struct nfs_fh coa_fh;
return res;
}
-#if defined(CONFIG_NFS_V4_1)
-
/*
* Lookup a layout inode by stateid
*
return htonl(NFS4_OK);
}
-#endif /* CONFIG_NFS_V4_1 */
#ifdef CONFIG_NFS_V4_2
static void nfs4_copy_cb_args(struct nfs4_copy_state *cp_state,
struct cb_offloadargs *args)
(2 + 2 + 3 + 3 + 3 + 3 + 3) * 4)
#define CB_OP_RECALL_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
-#if defined(CONFIG_NFS_V4_1)
#define CB_OP_LAYOUTRECALL_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
#define CB_OP_DEVICENOTIFY_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
#define CB_OP_SEQUENCE_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ + \
#define CB_OP_RECALLANY_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
#define CB_OP_RECALLSLOT_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
#define CB_OP_NOTIFY_LOCK_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
-#endif /* CONFIG_NFS_V4_1 */
#ifdef CONFIG_NFS_V4_2
#define CB_OP_OFFLOAD_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
#endif /* CONFIG_NFS_V4_2 */
return decode_fh(xdr, &args->fh);
}
-#if defined(CONFIG_NFS_V4_1)
static __be32 decode_layout_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
{
stateid->type = NFS4_LAYOUT_STATEID_TYPE;
return decode_lockowner(xdr, args);
}
-#endif /* CONFIG_NFS_V4_1 */
#ifdef CONFIG_NFS_V4_2
static __be32 decode_write_response(struct xdr_stream *xdr,
struct cb_offloadargs *args)
return status;
}
-#if defined(CONFIG_NFS_V4_1)
-
static __be32 encode_sessionid(struct xdr_stream *xdr,
const struct nfs4_sessionid *sid)
{
}
}
-#else /* CONFIG_NFS_V4_1 */
-
-static __be32
-preprocess_nfs41_op(int nop, unsigned int op_nr, struct callback_op **op)
-{
- return htonl(NFS4ERR_MINOR_VERS_MISMATCH);
-}
-
-static void nfs4_cb_free_slot(struct cb_process_state *cps)
-{
-}
-#endif /* CONFIG_NFS_V4_1 */
-
#ifdef CONFIG_NFS_V4_2
static __be32
preprocess_nfs42_op(int nop, unsigned int op_nr, struct callback_op **op)
.decode_args = decode_recall_args,
.res_maxsize = CB_OP_RECALL_RES_MAXSZ,
},
-#if defined(CONFIG_NFS_V4_1)
[OP_CB_LAYOUTRECALL] = {
.process_op = nfs4_callback_layoutrecall,
.decode_args = decode_layoutrecall_args,
.decode_args = decode_notify_lock_args,
.res_maxsize = CB_OP_NOTIFY_LOCK_RES_MAXSZ,
},
-#endif /* CONFIG_NFS_V4_1 */
#ifdef CONFIG_NFS_V4_2
[OP_CB_OFFLOAD] = {
.process_op = nfs4_callback_offload,
INIT_LIST_HEAD(&nn->nfs_volume_list);
#if IS_ENABLED(CONFIG_NFS_V4)
idr_init(&nn->cb_ident_idr);
-#endif
-#if IS_ENABLED(CONFIG_NFS_V4_1)
INIT_LIST_HEAD(&nn->nfs4_data_server_cache);
spin_lock_init(&nn->nfs4_data_server_lock);
-#endif
+#endif /* CONFIG_NFS_V4 */
spin_lock_init(&nn->nfs_client_lock);
nn->boot_time = ktime_get_real();
memset(&nn->rpcstats, 0, sizeof(nn->rpcstats));
nfs_cleanup_cb_ident_idr(net);
WARN_ON_ONCE(!list_empty(&nn->nfs_client_list));
WARN_ON_ONCE(!list_empty(&nn->nfs_volume_list));
-#if IS_ENABLED(CONFIG_NFS_V4_1)
+#if IS_ENABLED(CONFIG_NFS_V4)
WARN_ON_ONCE(!list_empty(&nn->nfs4_data_server_cache));
-#endif
+#endif /* CONFIG_NFS_V4 */
}
#ifdef CONFIG_PROC_FS
#if IS_ENABLED(CONFIG_NFS_V4)
extern int nfs4_decode_dirent(struct xdr_stream *,
struct nfs_entry *, bool);
-#endif
-#ifdef CONFIG_NFS_V4_1
extern const u32 nfs41_maxread_overhead;
extern const u32 nfs41_maxwrite_overhead;
extern const u32 nfs41_maxgetdevinfo_overhead;
-#endif
/* nfs4proc.c */
-#if IS_ENABLED(CONFIG_NFS_V4)
extern const struct rpc_procinfo nfs4_procedures[];
-#endif
+#endif /* CONFIG_NFS_V4 */
#ifdef CONFIG_NFS_V4_SECURITY_LABEL
extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags);
int nfs_filemap_write_and_wait_range(struct address_space *mapping,
loff_t lstart, loff_t lend);
-#ifdef CONFIG_NFS_V4_1
+#ifdef CONFIG_NFS_V4
static inline void
pnfs_bucket_clear_pnfs_ds_commit_verifiers(struct pnfs_commit_bucket *buckets,
unsigned int nbuckets)
array->nbuckets);
rcu_read_unlock();
}
-#else
+#else /* CONFIG_NFS_V4 */
static inline
void nfs_clear_pnfs_ds_commit_verifiers(struct pnfs_ds_commit_info *cinfo)
{
}
-#endif
+#endif /* CONFIG_NFS_V4 */
#ifdef CONFIG_MIGRATION
int nfs_migrate_folio(struct address_space *, struct folio *dst,
unsigned short nfs_callback_tcpport;
unsigned short nfs_callback_tcpport6;
int cb_users[NFS4_MAX_MINOR_VERSION + 1];
-#endif /* CONFIG_NFS_V4 */
-#if IS_ENABLED(CONFIG_NFS_V4_1)
struct list_head nfs4_data_server_cache;
spinlock_t nfs4_data_server_lock;
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_NFS_V4 */
struct nfs_netns_client *nfs_client;
spinlock_t nfs_client_lock;
ktime_t boot_time;
#if defined(CONFIG_NFS_V4_2)
#define NFS4_MAX_MINOR_VERSION 2
-#elif defined(CONFIG_NFS_V4_1)
-#define NFS4_MAX_MINOR_VERSION 1
#else
-#define NFS4_MAX_MINOR_VERSION 0
+#define NFS4_MAX_MINOR_VERSION 1
#endif
#if IS_ENABLED(CONFIG_NFS_V4)
extern int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
struct nfs_fattr *fattr);
-#if defined(CONFIG_NFS_V4_1)
extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *);
extern int nfs4_proc_create_session(struct nfs_client *, const struct cred *);
extern int nfs4_proc_destroy_session(struct nfs4_session *, const struct cred *);
!test_bit(NFS_SP4_MACH_CRED_COMMIT, &clp->cl_sp4_flags))
hdr->args.stable = NFS_FILE_SYNC;
}
-#else /* CONFIG_NFS_v4_1 */
-static inline bool
-is_ds_only_client(struct nfs_client *clp)
-{
- return false;
-}
-
-static inline bool
-is_ds_client(struct nfs_client *clp)
-{
- return false;
-}
-
-static inline void
-nfs4_state_protect(struct nfs_client *clp, unsigned long sp4_flags,
- struct rpc_clnt **clntp, struct rpc_message *msg)
-{
-}
-
-static inline void
-nfs4_state_protect_write(struct nfs_client *clp, struct rpc_clnt **clntp,
- struct rpc_message *msg, struct nfs_pgio_header *hdr)
-{
-}
-#endif /* CONFIG_NFS_V4_1 */
extern const struct nfs4_minor_version_ops *nfs_v4_minor_ops[];
struct nfs_client **);
int nfs40_discover_server_trunking(struct nfs_client *clp,
struct nfs_client **, const struct cred *);
-#if defined(CONFIG_NFS_V4_1)
int nfs41_discover_server_trunking(struct nfs_client *clp,
struct nfs_client **, const struct cred *);
extern void nfs4_schedule_session_recovery(struct nfs4_session *, int);
extern void nfs41_notify_server(struct nfs_client *);
bool nfs4_check_serverowner_major_id(struct nfs41_server_owner *o1,
struct nfs41_server_owner *o2);
-#else
-static inline void nfs4_schedule_session_recovery(struct nfs4_session *session, int err)
-{
-}
-#endif /* CONFIG_NFS_V4_1 */
extern struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *, const struct cred *, gfp_t);
extern void nfs4_put_state_owner(struct nfs4_state_owner *);
return ret < 0 ? ret : 0;
}
-#ifdef CONFIG_NFS_V4_1
/*
* Per auth flavor data server rpc clients
*/
}
}
-#endif /* CONFIG_NFS_V4_1 */
struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
{
clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion];
clp->cl_mig_gen = 1;
clp->cl_last_renewal = jiffies;
-#if IS_ENABLED(CONFIG_NFS_V4_1)
init_waitqueue_head(&clp->cl_lock_waitq);
-#endif
INIT_LIST_HEAD(&clp->pending_cb_stateids);
if (cl_init->minorversion != 0)
return 0;
}
-#if defined(CONFIG_NFS_V4_1)
-
/**
* nfs41_init_client - nfs_client initialization tasks for NFSv4.1+
* @clp: nfs_client to initialize
return 0;
}
-#endif /* CONFIG_NFS_V4_1 */
-
/*
* Initialize the minor version specific parts of an NFS4 client record
*/
return 0;
}
-#ifdef CONFIG_NFS_V4_1
/*
* Returns true if the server major ids match
*/
nfs_put_client(prev);
return status;
}
-#endif /* CONFIG_NFS_V4_1 */
static void nfs4_destroy_server(struct nfs_server *server)
{
return clp;
}
-#if defined(CONFIG_NFS_V4_1)
/* Common match routine for v4.0 and v4.1 callback services */
static bool nfs4_cb_match_client(const struct sockaddr *addr,
struct nfs_client *clp, u32 minorversion)
return NULL;
}
-#else /* CONFIG_NFS_V4_1 */
-
-struct nfs_client *
-nfs4_find_client_sessionid(struct net *net, const struct sockaddr *addr,
- struct nfs4_sessionid *sid, u32 minorversion)
-{
- return NULL;
-}
-#endif /* CONFIG_NFS_V4_1 */
-
/*
* Set up an NFS4 client
*/
*/
static void nfs4_session_limit_rwsize(struct nfs_server *server)
{
-#ifdef CONFIG_NFS_V4_1
struct nfs4_session *sess;
u32 server_resp_sz;
u32 server_rqst_sz;
server->rsize = server_resp_sz;
if (server->wsize > server_rqst_sz)
server->wsize = server_rqst_sz;
-#endif /* CONFIG_NFS_V4_1 */
}
/*
static int nfs4_do_setattr(struct inode *inode, const struct cred *cred,
struct nfs_fattr *fattr, struct iattr *sattr,
struct nfs_open_context *ctx, struct nfs4_label *ilabel);
-#ifdef CONFIG_NFS_V4_1
static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp,
const struct cred *cred,
struct nfs4_slot *slot,
const struct cred *);
static int nfs41_free_stateid(struct nfs_server *, nfs4_stateid *,
const struct cred *, bool);
-#endif
#ifdef CONFIG_NFS_V4_SECURITY_LABEL
static inline struct nfs4_label *
case -NFS4ERR_LEASE_MOVED:
nfs4_schedule_lease_moved_recovery(clp);
goto wait_on_recovery;
-#if defined(CONFIG_NFS_V4_1)
case -NFS4ERR_BADSESSION:
case -NFS4ERR_BADSLOT:
case -NFS4ERR_BAD_HIGH_SLOT:
case -NFS4ERR_SEQ_MISORDERED:
/* Handled in nfs41_sequence_process() */
goto wait_on_recovery;
-#endif /* defined(CONFIG_NFS_V4_1) */
case -NFS4ERR_FILE_OPEN:
if (exception->timeout > HZ) {
/* We have retried a decent amount, time to
res->sr_slot_ops = clp->cl_mvops->sequence_slot_ops;
}
-#if defined(CONFIG_NFS_V4_1)
-
static void nfs41_release_slot(struct nfs4_slot *slot)
{
struct nfs4_session *session;
};
-#endif /* !CONFIG_NFS_V4_1 */
-
static void nfs41_sequence_res_init(struct nfs4_sequence_res *res)
{
res->sr_timestamp = jiffies;
nfs4_state_set_mode_locked(state, state->state | fmode);
}
-#ifdef CONFIG_NFS_V4_1
static bool nfs_open_stateid_recover_openmode(struct nfs4_state *state)
{
if (state->n_rdonly && !test_bit(NFS_O_RDONLY_STATE, &state->flags))
return true;
return false;
}
-#endif /* CONFIG_NFS_V4_1 */
static void nfs_state_log_update_open_stateid(struct nfs4_state *state)
{
nfs_state_clear_delegation(state);
}
-#if defined(CONFIG_NFS_V4_1)
static int nfs41_test_and_free_expired_stateid(struct nfs_server *server,
nfs4_stateid *stateid, const struct cred *cred)
{
status = nfs4_open_expired(sp, state);
return status;
}
-#endif
/*
* on an EXCLUSIVE create, the server should send back a bitmask with FATTR4-*
return status;
}
-#if IS_ENABLED(CONFIG_NFS_V4_1)
static bool should_request_dir_deleg(struct inode *inode)
{
if (!directory_delegations)
return false;
return true;
}
-#else
-static bool should_request_dir_deleg(struct inode *inode)
-{
- return false;
-}
-#endif /* CONFIG_NFS_V4_1 */
static void nfs4_call_getattr_prepare(struct rpc_task *task, void *calldata)
{
return err;
}
-#if defined(CONFIG_NFS_V4_1)
static int nfs41_lock_expired(struct nfs4_state *state, struct file_lock *request)
{
struct nfs4_lock_state *lsp;
return 0;
return nfs4_lock_expired(state, request);
}
-#endif
static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request)
{
return status;
}
-#ifdef CONFIG_NFS_V4_1
struct nfs4_lock_waiter {
struct inode *inode;
struct nfs_lowner owner;
return status;
}
-#else /* !CONFIG_NFS_V4_1 */
-static inline int
-nfs4_retry_setlk(struct nfs4_state *state, int cmd, struct file_lock *request)
-{
- return nfs4_retry_setlk_simple(state, cmd, request);
-}
-#endif
static int
nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request)
return nfs4_server_supports_acls(NFS_SB(dentry->d_sb), NFS4ACL_ACL);
}
-#if defined(CONFIG_NFS_V4_1)
#define XATTR_NAME_NFSV4_DACL "system.nfs4_dacl"
static int nfs4_xattr_set_nfs4_dacl(const struct xattr_handler *handler,
return nfs4_server_supports_acls(NFS_SB(dentry->d_sb), NFS4ACL_SACL);
}
-#endif
-
#ifdef CONFIG_NFS_V4_SECURITY_LABEL
static int nfs4_xattr_set_nfs4_label(const struct xattr_handler *handler,
return err;
}
-#ifdef CONFIG_NFS_V4_1
-
/*
* This operation also signals the server that this client is
* performing migration recovery. The server can stop asserting
return status;
}
-#endif /* CONFIG_NFS_V4_1 */
-
/**
* nfs4_proc_get_locations - discover locations for a migrated FSID
* @server: pointer to nfs_server to process
return status;
}
-#ifdef CONFIG_NFS_V4_1
-
/*
* This operation also signals the server that this client is
* performing "lease moved" recovery. The server can stop asserting
return status;
}
-#endif /* CONFIG_NFS_V4_1 */
-
/**
* nfs4_proc_fsid_present - Is this FSID present or absent on server?
* @inode: inode on FSID to check
return err;
}
-#ifdef CONFIG_NFS_V4_1
/*
* Check the exchange flags returned by the server for invalid flags, having
* both PNFS and NON_PNFS flags set, and not having one of NON_PNFS, PNFS, or
return ret;
}
-#endif /* CONFIG_NFS_V4_1 */
-
struct nfs4_get_lease_time_data {
struct nfs4_get_lease_time_args *args;
struct nfs4_get_lease_time_res *res;
return nfs4_call_sync_custom(&task_setup);
}
-#ifdef CONFIG_NFS_V4_1
-
/*
* Initialize the values to be used by the client in CREATE_SESSION
* If nfs4_init_session set the fore channel request and response sizes,
return s1->seqid == 0 || s2->seqid == 0;
}
-#endif /* CONFIG_NFS_V4_1 */
-
bool nfs4_match_stateid(const nfs4_stateid *s1,
const nfs4_stateid *s2)
{
}
-#if defined(CONFIG_NFS_V4_1)
static const struct nfs4_sequence_slot_ops nfs41_sequence_slot_ops = {
.process = nfs41_sequence_process,
.done = nfs41_sequence_done,
.state_renewal_ops = &nfs41_state_renewal_ops,
.mig_recovery_ops = &nfs41_mig_recovery_ops,
};
-#endif
#if defined(CONFIG_NFS_V4_2)
static const struct nfs4_minor_version_ops nfs_v4_2_minor_ops = {
#if defined(CONFIG_NFS_V4_0)
[0] = &nfs_v4_0_minor_ops,
#endif /* CONFIG_NFS_V4_0 */
-#if defined(CONFIG_NFS_V4_1)
[1] = &nfs_v4_1_minor_ops,
-#endif
#if defined(CONFIG_NFS_V4_2)
[2] = &nfs_v4_2_minor_ops,
#endif
.set = nfs4_xattr_set_nfs4_acl,
};
-#if defined(CONFIG_NFS_V4_1)
static const struct xattr_handler nfs4_xattr_nfs4_dacl_handler = {
.name = XATTR_NAME_NFSV4_DACL,
.list = nfs4_xattr_list_nfs4_dacl,
.get = nfs4_xattr_get_nfs4_sacl,
.set = nfs4_xattr_set_nfs4_sacl,
};
-#endif
#ifdef CONFIG_NFS_V4_2
static const struct xattr_handler nfs4_xattr_nfs4_user_handler = {
const struct xattr_handler * const nfs4_xattr_handlers[] = {
&nfs4_xattr_nfs4_acl_handler,
-#if defined(CONFIG_NFS_V4_1)
&nfs4_xattr_nfs4_dacl_handler,
&nfs4_xattr_nfs4_sacl_handler,
-#endif
#ifdef CONFIG_NFS_V4_SECURITY_LABEL
&nfs4_xattr_nfs4_label_handler,
#endif
}
}
-#if defined(CONFIG_NFS_V4_1)
-
static void nfs41_set_max_slotid_locked(struct nfs4_slot_table *tbl,
u32 target_highest_slotid)
{
return 0;
}
EXPORT_SYMBOL_GPL(nfs4_init_ds_session);
-
-#endif /* defined(CONFIG_NFS_V4_1) */
return clp->cl_session;
}
-#if defined(CONFIG_NFS_V4_1)
extern void nfs41_set_target_slotid(struct nfs4_slot_table *tbl,
u32 target_highest_slotid);
extern void nfs41_update_target_slotid(struct nfs4_slot_table *tbl,
*/
#define nfs_session_id_hash(sess_id) \
(~crc32_le(0xFFFFFFFF, &(sess_id)->data[0], sizeof((sess_id)->data)))
-#else /* defined(CONFIG_NFS_V4_1) */
-static inline int nfs4_init_session(struct nfs_client *clp)
-{
- return 0;
-}
-
-/*
- * Determine if sessions are in use.
- */
-static inline int nfs4_has_session(const struct nfs_client *clp)
-{
- return 0;
-}
-
-static inline int nfs4_has_persistent_session(const struct nfs_client *clp)
-{
- return 0;
-}
-
-#define nfs_session_id_hash(session) (0)
-
-#endif /* defined(CONFIG_NFS_V4_1) */
#endif /* IS_ENABLED(CONFIG_NFS_V4) */
#endif /* __LINUX_FS_NFS_NFS4SESSION_H */
return nfs4_drain_slot_tbl(&ses->fc_slot_table);
}
-#if defined(CONFIG_NFS_V4_1)
-
static void nfs41_finish_session_reset(struct nfs_client *clp)
{
clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
return status;
}
-#endif /* CONFIG_NFS_V4_1 */
-
/**
* nfs4_get_clid_cred - Acquire credential for a setclientid operation
* @clp: client state handle
return status;
}
-#ifdef CONFIG_NFS_V4_1
void nfs4_schedule_session_recovery(struct nfs4_session *session, int err)
{
struct nfs_client *clp = session->clp;
set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
}
}
-#else /* CONFIG_NFS_V4_1 */
-static int nfs4_reset_session(struct nfs_client *clp) { return 0; }
-
-static int nfs4_bind_conn_to_session(struct nfs_client *clp)
-{
- return 0;
-}
-
-static void nfs4_layoutreturn_any_run(struct nfs_client *clp)
-{
-}
-#endif /* CONFIG_NFS_V4_1 */
static void nfs4_state_manager(struct nfs_client *clp)
{
#define CREATE_TRACE_POINTS
#include "nfs4trace.h"
-#ifdef CONFIG_NFS_V4_1
EXPORT_TRACEPOINT_SYMBOL_GPL(nfs4_pnfs_read);
EXPORT_TRACEPOINT_SYMBOL_GPL(nfs4_pnfs_write);
EXPORT_TRACEPOINT_SYMBOL_GPL(nfs4_pnfs_commit_ds);
EXPORT_TRACEPOINT_SYMBOL_GPL(bl_pr_key_unreg_err);
EXPORT_TRACEPOINT_SYMBOL_GPL(fl_getdevinfo);
-#endif
DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
-#ifdef CONFIG_NFS_V4_1
DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
)
);
-#endif /* CONFIG_NFS_V4_1 */
-
TRACE_EVENT(nfs4_setup_sequence,
TP_PROTO(
const struct nfs4_session *session,
)
);
-#ifdef CONFIG_NFS_V4_1
DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
TP_PROTO(
const struct nfs4_state *state,
DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
-#endif /* CONFIG_NFS_V4_1 */
DECLARE_EVENT_CLASS(nfs4_lookup_event,
TP_PROTO(
DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
-#ifdef CONFIG_NFS_V4_1
#define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) \
(lseg ? nfs_stateid_hash(&lseg->pls_layout->plh_stateid) : 0)
-#else
-#define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) (0)
-#endif
DECLARE_EVENT_CLASS(nfs4_read_event,
TP_PROTO(
), \
TP_ARGS(hdr, error))
DEFINE_NFS4_READ_EVENT(nfs4_read);
-#ifdef CONFIG_NFS_V4_1
DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
-#endif /* CONFIG_NFS_V4_1 */
DECLARE_EVENT_CLASS(nfs4_write_event,
TP_PROTO(
), \
TP_ARGS(hdr, error))
DEFINE_NFS4_WRITE_EVENT(nfs4_write);
-#ifdef CONFIG_NFS_V4_1
DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
-#endif /* CONFIG_NFS_V4_1 */
DECLARE_EVENT_CLASS(nfs4_commit_event,
TP_PROTO(
), \
TP_ARGS(data, error))
DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
-#ifdef CONFIG_NFS_V4_1
DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
TRACE_EVENT(nfs4_layoutget,
DEFINE_NFS4_INODE_EVENT(nfs4_listxattr);
#endif /* CONFIG_NFS_V4_2 */
-#endif /* CONFIG_NFS_V4_1 */
-
#endif /* _TRACE_NFS4_H */
#undef TRACE_INCLUDE_PATH
#define encode_secinfo_maxsz (op_encode_hdr_maxsz + nfs4_name_maxsz)
#define decode_secinfo_maxsz (op_decode_hdr_maxsz + 1 + ((NFS_MAX_SECFLAVORS * (16 + GSS_OID_MAX_LEN)) / 4))
-#if defined(CONFIG_NFS_V4_1)
#define NFS4_MAX_MACHINE_NAME_LEN (64)
#define IMPL_NAME_LIMIT (sizeof(utsname()->sysname) + sizeof(utsname()->release) + \
sizeof(utsname()->version) + sizeof(utsname()->machine) + 8)
#define encode_free_stateid_maxsz (op_encode_hdr_maxsz + 1 + \
XDR_QUADLEN(NFS4_STATEID_SIZE))
#define decode_free_stateid_maxsz (op_decode_hdr_maxsz)
-#else /* CONFIG_NFS_V4_1 */
-#define encode_sequence_maxsz 0
-#define decode_sequence_maxsz 0
-#define encode_get_dir_deleg_maxsz 0
-#define decode_get_dir_deleg_maxsz 0
-#define encode_layoutreturn_maxsz 0
-#define decode_layoutreturn_maxsz 0
-#define encode_layoutget_maxsz 0
-#define decode_layoutget_maxsz 0
-#endif /* CONFIG_NFS_V4_1 */
#define NFS4_enc_compound_sz (1024) /* XXX: large enough? */
#define NFS4_dec_compound_sz (1024) /* XXX: large enough? */
decode_putfh_maxsz + \
decode_getfh_maxsz + \
decode_renew_maxsz)
-#if defined(CONFIG_NFS_V4_1)
#define NFS4_enc_bind_conn_to_session_sz \
(compound_encode_hdr_maxsz + \
encode_bind_conn_to_session_maxsz)
#define NFS4_dec_sequence_sz \
(compound_decode_hdr_maxsz + \
decode_sequence_maxsz)
-#endif
#define NFS4_enc_get_lease_time_sz (compound_encode_hdr_maxsz + \
encode_sequence_maxsz + \
encode_putrootfh_maxsz + \
decode_sequence_maxsz + \
decode_putrootfh_maxsz + \
decode_fsinfo_maxsz)
-#if defined(CONFIG_NFS_V4_1)
#define NFS4_enc_reclaim_complete_sz (compound_encode_hdr_maxsz + \
encode_sequence_maxsz + \
encode_reclaim_complete_maxsz)
decode_sequence_maxsz) *
XDR_UNIT);
EXPORT_SYMBOL_GPL(nfs41_maxgetdevinfo_overhead);
-#endif /* CONFIG_NFS_V4_1 */
static const umode_t nfs_type2fmt[] = {
[NF4BAD] = 0,
encode_string(xdr, name->len, name->name);
}
-#if defined(CONFIG_NFS_V4_1)
/* NFSv4.1 operations */
static void encode_bind_conn_to_session(struct xdr_stream *xdr,
const struct nfs41_bind_conn_to_session_args *args,
encode_op_hdr(xdr, OP_RECLAIM_COMPLETE, decode_reclaim_complete_maxsz, hdr);
encode_uint32(xdr, args->one_fs);
}
-#endif /* CONFIG_NFS_V4_1 */
static void encode_sequence(struct xdr_stream *xdr,
const struct nfs4_sequence_args *args,
struct compound_hdr *hdr)
{
-#if defined(CONFIG_NFS_V4_1)
struct nfs4_session *session;
struct nfs4_slot_table *tp;
struct nfs4_slot *slot = args->sa_slot;
*p++ = cpu_to_be32(slot->slot_nr);
*p++ = cpu_to_be32(tp->highest_used_slotid);
*p = cpu_to_be32(args->sa_cache_this);
-#endif /* CONFIG_NFS_V4_1 */
}
-#ifdef CONFIG_NFS_V4_1
static void
encode_get_dir_delegation(struct xdr_stream *xdr, struct compound_hdr *hdr)
{
encode_op_hdr(xdr, OP_FREE_STATEID, decode_free_stateid_maxsz, hdr);
encode_nfs4_stateid(xdr, &args->stateid);
}
-#else
-static inline void
-encode_get_dir_delegation(struct xdr_stream *xdr, struct compound_hdr *hdr)
-{
-}
-
-static inline void
-encode_layoutreturn(struct xdr_stream *xdr,
- const struct nfs4_layoutreturn_args *args,
- struct compound_hdr *hdr)
-{
-}
-
-static void
-encode_layoutget(struct xdr_stream *xdr,
- const struct nfs4_layoutget_args *args,
- struct compound_hdr *hdr)
-{
-}
-#endif /* CONFIG_NFS_V4_1 */
/*
* END OF "GENERIC" ENCODE ROUTINES.
static u32 nfs4_xdr_minorversion(const struct nfs4_sequence_args *args)
{
-#if defined(CONFIG_NFS_V4_1)
struct nfs4_session *session = args->sa_slot->table->session;
if (session)
return session->clp->cl_mvops->minor_version;
-#endif /* CONFIG_NFS_V4_1 */
return 0;
}
encode_nops(&hdr);
}
-#if defined(CONFIG_NFS_V4_1)
/*
* BIND_CONN_TO_SESSION request
*/
encode_nops(&hdr);
}
-#endif
-
/*
* a GET_LEASE_TIME request
*/
encode_nops(&hdr);
}
-#ifdef CONFIG_NFS_V4_1
-
/*
* a RECLAIM_COMPLETE request
*/
encode_free_stateid(xdr, args, &hdr);
encode_nops(&hdr);
}
-#endif /* CONFIG_NFS_V4_1 */
static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char **string)
{
return decode_secinfo_common(xdr, res);
}
-#if defined(CONFIG_NFS_V4_1)
static int decode_secinfo_no_name(struct xdr_stream *xdr, struct nfs4_secinfo_res *res)
{
int status = decode_op_hdr(xdr, OP_SECINFO_NO_NAME);
{
return decode_op_hdr(xdr, OP_RECLAIM_COMPLETE);
}
-#endif /* CONFIG_NFS_V4_1 */
static int decode_sequence(struct xdr_stream *xdr,
struct nfs4_sequence_res *res,
struct rpc_rqst *rqstp)
{
-#if defined(CONFIG_NFS_V4_1)
struct nfs4_session *session;
struct nfs4_sessionid id;
u32 dummy;
out_overflow:
status = -EIO;
goto out_err;
-#else /* CONFIG_NFS_V4_1 */
- return 0;
-#endif /* CONFIG_NFS_V4_1 */
}
-#if defined(CONFIG_NFS_V4_1)
static int decode_layout_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
{
stateid->type = NFS4_LAYOUT_STATEID_TYPE;
res->status = decode_op_hdr(xdr, OP_FREE_STATEID);
return res->status;
}
-#else
-static int decode_get_dir_delegation(struct xdr_stream *xdr,
- struct nfs4_getattr_res *res)
-{
- return 0;
-}
-
-static inline
-int decode_layoutreturn(struct xdr_stream *xdr,
- struct nfs4_layoutreturn_res *res)
-{
- return 0;
-}
-
-static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,
- struct nfs4_layoutget_res *res)
-{
- return 0;
-}
-
-#endif /* CONFIG_NFS_V4_1 */
/*
* END OF "GENERIC" DECODE ROUTINES.
return status;
}
-#if defined(CONFIG_NFS_V4_1)
/*
* Decode BIND_CONN_TO_SESSION response
*/
return status;
}
-#endif
-
/*
* Decode GET_LEASE_TIME response
*/
return status;
}
-#ifdef CONFIG_NFS_V4_1
-
/*
* Decode RECLAIM_COMPLETE response
*/
out:
return status;
}
-#endif /* CONFIG_NFS_V4_1 */
/**
* nfs4_decode_dirent - Decode a single NFSv4 directory entry stored in
STUB(proc)
#endif /* CONFIG_NFS_V4_0 */
-#if defined(CONFIG_NFS_V4_1)
#define PROC41(proc, argtype, restype) \
PROC(proc, argtype, restype)
-#else
-#define PROC41(proc, argtype, restype) \
- STUB(proc)
-#endif
#if defined(CONFIG_NFS_V4_2)
#define PROC42(proc, argtype, restype) \
PNFS_TRY_AGAIN = 2,
};
-#ifdef CONFIG_NFS_V4_1
+#if IS_ENABLED(CONFIG_NFS_V4)
#define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4"
}
#endif /* NFS_DEBUG */
-#else /* CONFIG_NFS_V4_1 */
+#else /* CONFIG_NFS_V4 */
static inline bool nfs_have_layout(struct inode *inode)
{
return false;
}
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_NFS_V4 */
#if IS_ENABLED(CONFIG_NFS_V4_2)
int pnfs_report_layoutstat(struct inode *inode, gfp_t gfp_flags);
struct nfs_server *server = NFS_SERVER(inode);
const struct nfs_pageio_ops *pg_ops = &nfs_pgio_rw_ops;
-#ifdef CONFIG_NFS_V4_1
+#if IS_ENABLED(CONFIG_NFS_V4)
if (server->pnfs_curr_ld && !force_mds)
pg_ops = server->pnfs_curr_ld->pg_read_ops;
-#endif
+#endif /* CONFIG_NFS_V4 */
nfs_pageio_init(pgio, inode, pg_ops, compl_ops, &nfs_rw_read_ops,
server->rsize, 0);
}
seq_printf(m, ",lease_expired=%ld",
time_after(expire, jiffies) ? 0 : (jiffies - expire) / HZ);
}
-#ifdef CONFIG_NFS_V4_1
+
static void show_sessions(struct seq_file *m, struct nfs_server *server)
{
if (nfs4_has_session(server->nfs_client))
seq_puts(m, ",sessions");
}
-#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)
{
seq_printf(m, ",pnfs=");
impl_id->date.seconds, impl_id->date.nseconds);
}
}
-#else
-#if IS_ENABLED(CONFIG_NFS_V4)
-static void show_pnfs(struct seq_file *m, struct nfs_server *server)
-{
-}
-#endif
+#else /* CONFIG_NFS_V4 */
static void show_implementation_id(struct seq_file *m, struct nfs_server *nfss)
{
}
-#endif
+#endif /* CONFIG_NFS_V4 */
int nfs_show_devname(struct seq_file *m, struct dentry *root)
{
static struct kobj_attribute nfs_sysfs_attr_shutdown = __ATTR_RW(shutdown);
-#if IS_ENABLED(CONFIG_NFS_V4_1)
+#if IS_ENABLED(CONFIG_NFS_V4)
static ssize_t
implid_domain_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf)
static struct kobj_attribute nfs_sysfs_attr_implid_name = __ATTR_RO(implid_name);
-#endif /* IS_ENABLED(CONFIG_NFS_V4_1) */
+#endif /* IS_ENABLED(CONFIG_NFS_V4) */
#define RPC_CLIENT_NAME_SIZE 64
.child_ns_type = nfs_netns_object_child_ns_type,
};
-#if IS_ENABLED(CONFIG_NFS_V4_1)
+#if IS_ENABLED(CONFIG_NFS_V4)
static void nfs_sysfs_add_nfsv41_server(struct nfs_server *server)
{
int ret;
pr_warn("NFS: sysfs_create_file_ns for server-%d failed (%d)\n",
server->s_sysfs_id, ret);
}
-#else /* CONFIG_NFS_V4_1 */
+#else /* CONFIG_NFS_V4 */
static inline void nfs_sysfs_add_nfsv41_server(struct nfs_server *server)
{
}
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_NFS_V4 */
#if IS_ENABLED(CONFIG_NFS_LOCALIO)
struct nfs_server *server = NFS_SERVER(inode);
const struct nfs_pageio_ops *pg_ops = &nfs_pgio_rw_ops;
-#ifdef CONFIG_NFS_V4_1
+#if IS_ENABLED(CONFIG_NFS_V4)
if (server->pnfs_curr_ld && !force_mds)
pg_ops = server->pnfs_curr_ld->pg_write_ops;
#endif
#define NFS_SP4_MACH_CRED_WRITE 5 /* WRITE */
#define NFS_SP4_MACH_CRED_COMMIT 6 /* COMMIT */
#define NFS_SP4_MACH_CRED_PNFS_CLEANUP 7 /* LAYOUTRETURN */
-#if IS_ENABLED(CONFIG_NFS_V4_1)
wait_queue_head_t cl_lock_waitq;
-#endif /* CONFIG_NFS_V4_1 */
#endif /* CONFIG_NFS_V4 */
/* Our own IP address, as a null-terminated string.
unsigned char renew:1;
};
-#endif /* CONFIG_NFS_V4 */
-
-#ifdef CONFIG_NFS_V4_1
-
struct pnfs_commit_bucket {
struct list_head written;
struct list_head committing;
struct pnfs_ds_commit_info {
};
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_NFS_V4 */
#ifdef CONFIG_NFS_V4_2
struct nfs42_falloc_args {