nfs41: adjust max_rqst_sz, max_resp_sz w.r.t to rsize, wsize
Subsystems (2)
PATCH 1/10 nfs41: adjust max_rqst_sz, max_resp_sz w.r.t to rsize, wsize
The v4.1 client should take into account the desired rsize, wsize when negotiating the max size in CREATE_SESSION. Accordingly, it should use rsize, wsize that are smaller than the session negotiated values.
--- fs/nfs/client.c | 14 ++++++++++---- fs/nfs/internal.h | 4 ++++ fs/nfs/nfs4proc.c | 7 +++++-- fs/nfs/nfs4xdr.c | 14 ++++++++++++++ 4 files changed, 33 insertions(+), 6 deletions(-)
fs/nfs/client.c +10 -4
@@ -911,8 +911,10 @@ static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo * server->maxfilesize = fsinfo->maxfilesize; -/* We're airborne Set socket buffersize */ -rpc_setbufsize (server->client, server->wsize +100 , server->rsize +100 ); +/* We're airborne Set socket buffersize. */ +if (!nfs4_has_session (server->nfs_client)) +rpc_setbufsize (server->client, server->wsize +100 , + server->rsize +100 ); }/*
@@ -1260,10 +1262,14 @@ error:static void nfs4_session_set_rwsize (struct nfs_server *server) {#ifdef CONFIG_NFS_V4_1 +struct nfs4_session *sess;if (!nfs4_has_session (server->nfs_client))return ; - server->rsize = server->nfs_client->cl_session->fc_attrs.max_resp_sz; - server->wsize = server->nfs_client->cl_session->fc_attrs.max_rqst_sz; + sess = server->nfs_client->cl_session; + server->rsize = sess->fc_attrs.max_resp_sz - nfs41_maxread_overhead; + server->wsize = sess->fc_attrs.max_rqst_sz - nfs41_maxwrite_overhead; +rpc_setbufsize (server->client, sess->fc_attrs.max_rqst_sz, + sess->fc_attrs.max_resp_sz);#endif /* CONFIG_NFS_V4_1 */ }
fs/nfs/internal.h +4 -0
@@ -195,6 +195,10 @@ static inline void nfs4_restart_rpc(struct rpc_task *task,#ifdef CONFIG_NFS_V4 extern __be32 *nfs4_decode_dirent (__be32 *p,struct nfs_entry *entry,int plus);#endif +#ifdef CONFIG_NFS_V4_1 +extern const u32 nfs41_maxread_overhead; +extern const u32 nfs41_maxwrite_overhead; +#endif /* nfs4proc.c */ #ifdef CONFIG_NFS_V4
fs/nfs/nfs4proc.c +5 -2
@@ -4827,13 +4827,16 @@ int nfs4_proc_destroy_session(struct nfs4_session *session)int nfs4_init_session (struct nfs_server *server) {struct nfs_client *clp = server->nfs_client; +struct nfs4_session *session;int ret;if (!nfs4_has_session (clp))return 0 ; - clp->cl_session->fc_attrs.max_rqst_sz = server->wsize; - clp->cl_session->fc_attrs.max_resp_sz = server->rsize; + session = clp->cl_session; + session->fc_attrs.max_rqst_sz = server->wsize + nfs41_maxwrite_overhead; + session->fc_attrs.max_resp_sz = server->rsize + nfs41_maxread_overhead; + ret =nfs4_recover_expired_lease (server);if (!ret) ret =nfs4_check_client_ready (clp);
fs/nfs/nfs4xdr.c +14 -0
@@ -46,6 +46,7 @@#include <linux/proc_fs.h> #include <linux/kdev_t.h> #include <linux/sunrpc/clnt.h> +#include <linux/sunrpc/msg_prot.h> #include <linux/nfs.h> #include <linux/nfs4.h> #include <linux/nfs_fs.h>
@@ -676,6 +677,19 @@ static int nfs4_stat_to_errno(int); decode_sequence_maxsz + \ decode_putrootfh_maxsz + \ decode_fsinfo_maxsz) + +const u32 nfs41_maxwrite_overhead = ((RPC_MAX_HEADER_WITH_AUTH + + compound_encode_hdr_maxsz + + encode_sequence_maxsz + + encode_putfh_maxsz + + encode_getattr_maxsz) * +XDR_UNIT ); + +const u32 nfs41_maxread_overhead = ((RPC_MAX_HEADER_WITH_AUTH + + compound_decode_hdr_maxsz + + decode_sequence_maxsz + + decode_putfh_maxsz) * +XDR_UNIT );#endif /* CONFIG_NFS_V4_1 */ static const umode_t nfs_type2fmt[] = {
Signature · 1 line
1.6.2.5
PATCH 2/10 nfs41: add support for callback with RPC version number 4
The NFSv4.1 spec-29 (18.36.3) says that the server MUST use an ONC RPC (program) version number equal to 4 in callbacks sent to the client. For now we allow both versions 1 and 4.
--- fs/nfs/callback.c | 1 + fs/nfs/callback_xdr.c | 7 +++++++ fs/nfs/internal.h | 1 + fs/nfs/nfs4_fs.h | 1 + 4 files changed, 10 insertions(+), 0 deletions(-)
fs/nfs/callback.c +1 -0
@@ -397,6 +397,7 @@ static int nfs_callback_authenticate(struct svc_rqst *rqstp)*/ static struct svc_version *nfs4_callback_version[] = { [1 ] = &nfs4_callback_version1, + [4 ] = &nfs4_callback_version4, };static struct svc_stat nfs4_callback_stats;
fs/nfs/callback_xdr.c +7 -0
@@ -718,3 +718,10 @@ struct svc_version nfs4_callback_version1 = { .vs_dispatch = NULL, }; +struct svc_version nfs4_callback_version4 = { + .vs_vers =4 , + .vs_nproc =ARRAY_SIZE (nfs4_callback_procedures1), + .vs_proc = nfs4_callback_procedures1, + .vs_xdrsize =NFS4_CALLBACK_XDRSIZE , + .vs_dispatch =NULL , +};
fs/nfs/internal.h +1 -0
@@ -156,6 +156,7 @@ struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentr/* callback_xdr.c */ extern struct svc_version nfs4_callback_version1; +extern struct svc_version nfs4_callback_version4;/* pagelist.c */ extern int __init nfs_init_nfspagecache (void );
fs/nfs/nfs4_fs.h +1 -0
@@ -287,6 +287,7 @@ struct nfs4_mount_data;/* callback_xdr.c */ extern struct svc_version nfs4_callback_version1; +extern struct svc_version nfs4_callback_version4;#else
Signature · 1 line
1.6.2.5
PATCH 3/10 nfs41: fix cb_recall bug
in NFSv4.1 the seqid part of a stateid in CB_RECALL must be 0
--- fs/nfs/delegation.c | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-)
fs/nfs/delegation.c +17 -4
@@ -432,18 +432,31 @@ int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *s {struct nfs_client *clp =NFS_SERVER (inode)->nfs_client;struct nfs_delegation *delegation; +u32 seqid_len =0 ;rcu_read_lock (); delegation =rcu_dereference (NFS_I (inode)->delegation); -if (delegation ==NULL ||memcmp (delegation->stateid.data, stateid->data, -sizeof (delegation->stateid.data)) !=0 ) { -rcu_read_unlock (); -return -ENOENT ; +if (delegation ==NULL ) + goto enoent; + +if (clp->cl_minorversion >0 ) { +if (((u32 *) &stateid->data)[0 ] !=0 ) + goto enoent; + seqid_len =4 ; } + +if (memcmp (&delegation->stateid.data[seqid_len], + &stateid->data[seqid_len], +sizeof (stateid->data)-seqid_len)) + goto enoent; +nfs_mark_return_delegation (clp, delegation);rcu_read_unlock ();nfs_delegation_run_state_manager (clp);return 0 ; +enoent: +rcu_read_unlock (); +return -ENOENT ; }/*
Signature · 1 line
1.6.2.5
PATCH 4/10 nfs4: minor delegation cleaning
--- fs/nfs/delegation.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
fs/nfs/delegation.c +2 -4
@@ -377,8 +377,7 @@ static void nfs_client_mark_return_all_delegations(struct nfs_client *clp)rcu_read_lock ();list_for_each_entry_rcu (delegation, &clp->cl_delegations, super_list) { -set_bit (NFS_DELEGATION_RETURN , &delegation->flags); -set_bit (NFS4CLNT_DELEGRETURN , &clp->cl_state); +nfs_mark_return_delegation (clp, delegation); }rcu_read_unlock (); }
@@ -413,8 +412,7 @@ static void nfs_client_mark_return_unreferenced_delegations(struct nfs_client *clist_for_each_entry_rcu (delegation, &clp->cl_delegations, super_list) {if (test_and_clear_bit (NFS_DELEGATION_REFERENCED , &delegation->flags))continue ; -set_bit (NFS_DELEGATION_RETURN , &delegation->flags); -set_bit (NFS4CLNT_DELEGRETURN , &clp->cl_state); +nfs_mark_return_delegation (clp, delegation); }rcu_read_unlock (); }
Signature · 1 line
1.6.2.5
PATCH 5/10 nfs4: return/expire delegations depending on their type
--- fs/nfs/delegation.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-)
fs/nfs/delegation.c +16 -4
@@ -371,29 +371,41 @@ void nfs_super_return_all_delegations(struct super_block *sb)nfs_client_return_marked_delegations (clp); } -static void nfs_client_mark_return_all_delegations (struct nfs_client *clp) +static +void nfs_client_mark_return_all_delegation_types (struct nfs_client *clp,fmode_t flags) {struct nfs_delegation *delegation;rcu_read_lock ();list_for_each_entry_rcu (delegation, &clp->cl_delegations, super_list) { -nfs_mark_return_delegation (clp, delegation); +if (delegation->type & flags) +nfs_mark_return_delegation (clp, delegation); }rcu_read_unlock (); } +static void nfs_client_mark_return_all_delegations (struct nfs_client *clp) +{ +nfs_client_mark_return_all_delegation_types (clp,FMODE_READ |FMODE_WRITE ); +} +static void nfs_delegation_run_state_manager (struct nfs_client *clp) {if (test_bit (NFS4CLNT_DELEGRETURN , &clp->cl_state))nfs4_schedule_state_manager (clp); } -void nfs_expire_all_delegations (struct nfs_client *clp) +void nfs_expire_all_delegation_types (struct nfs_client *clp,fmode_t flags) { -nfs_client_mark_return_all_delegations (clp); +nfs_client_mark_return_all_delegation_types (clp, flags);nfs_delegation_run_state_manager (clp); } +void nfs_expire_all_delegations (struct nfs_client *clp) +{ +nfs_expire_all_delegation_types (clp,FMODE_READ |FMODE_WRITE ); +} +/* * Return all delegations following an NFS4ERR_CB_PATH_DOWN error. */
Signature · 1 line
1.6.2.5
PATCH 6/10 nfs41: initial support for CB_RECALL_ANY
For now the clients returns _all_ the delegations of the specificed type it holds
--- fs/nfs/callback.h | 10 ++++++++++ fs/nfs/callback_proc.c | 30 ++++++++++++++++++++++++++++++ fs/nfs/callback_xdr.c | 27 ++++++++++++++++++++++++++- fs/nfs/delegation.h | 1 + 4 files changed, 67 insertions(+), 1 deletions(-)
fs/nfs/callback.h +10 -0
@@ -103,8 +103,18 @@ struct cb_sequenceres { uint32_t csr_target_highestslotid; }; +#define RCA4_TYPE_MASK_RDATA_DLG 0 +#define RCA4_TYPE_MASK_WDATA_DLG 1 + +struct cb_recallanyargs { +struct sockaddr *craa_addr; +uint32_t craa_objs_to_keep; +uint32_t craa_type_mask; +}; +extern unsigned nfs4_callback_sequence (struct cb_sequenceargs *args,struct cb_sequenceres *res); +extern unsigned nfs4_callback_recallany (struct cb_recallanyargs *args,void *dummy);#endif /* CONFIG_NFS_V4_1 */
fs/nfs/callback_proc.c +30 -0
@@ -227,4 +227,34 @@ out:return res->csr_status; } +unsigned nfs4_callback_recallany (struct cb_recallanyargs *args, +void *dummy) +{ +struct nfs_client *clp; +int status; +fmode_t flags =0 ; + + status =htonl (NFS4ERR_OP_NOT_IN_SESSION ); + clp =nfs_find_client (args->craa_addr,4 ); +if (clp ==NULL ) + goto out; + +dprintk ("NFS: RECALL_ANY callback request from %s\n" , +rpc_peeraddr2str (clp->cl_rpcclient,RPC_DISPLAY_ADDR )); + +if (test_bit (RCA4_TYPE_MASK_RDATA_DLG , (const unsigned long *) + &args->craa_type_mask)) + flags =FMODE_READ ; +if (test_bit (RCA4_TYPE_MASK_WDATA_DLG , (const unsigned long *) + &args->craa_type_mask)) + flags |=FMODE_WRITE ; + +if (flags) +nfs_expire_all_delegation_types (clp, flags); + status =htonl (NFS4_OK ); + out: +dprintk ("%s: exit with status = %d\n" , __func__,ntohl (status)); +return status; +} +#endif /* CONFIG_NFS_V4_1 */
fs/nfs/callback_xdr.c +26 -1
@@ -23,6 +23,7 @@#if defined(CONFIG_NFS_V4_1 )#define CB_OP_SEQUENCE_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ + \ 4 + 1 + 3) +#define CB_OP_RECALLANY_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)#endif /* CONFIG_NFS_V4_1 */ #define NFSDBG_FACILITY NFSDBG_CALLBACK
@@ -326,6 +327,25 @@ out_free: goto out; } +static unsigned decode_recallany_args (struct svc_rqst *rqstp, +struct xdr_stream *xdr, +struct cb_recallanyargs *args) +{ +uint32_t *p; + + args->craa_addr =svc_addr (rqstp); + p =read_buf (xdr,4 ); +if (unlikely (p ==NULL )) +return htonl (NFS4ERR_BADXDR ); + args->craa_objs_to_keep =ntohl (*p++); + p =read_buf (xdr,4 ); +if (unlikely (p ==NULL )) +return htonl (NFS4ERR_BADXDR ); + args->craa_type_mask =ntohl (*p); + +return 0 ; +} +#endif /* CONFIG_NFS_V4_1 */ static __be32 encode_string (struct xdr_stream *xdr,unsigned int len,const char *str)
@@ -533,6 +553,7 @@ preprocess_nfs41_op(int nop, unsigned int op_nr, struct callback_op **op)case OP_CB_GETATTR :case OP_CB_RECALL :case OP_CB_SEQUENCE : +case OP_CB_RECALL_ANY : *op = &callback_ops[op_nr];break ;
@@ -540,7 +561,6 @@ preprocess_nfs41_op(int nop, unsigned int op_nr, struct callback_op **op)case OP_CB_NOTIFY_DEVICEID :case OP_CB_NOTIFY :case OP_CB_PUSH_DELEG : -case OP_CB_RECALL_ANY :case OP_CB_RECALLABLE_OBJ_AVAIL :case OP_CB_RECALL_SLOT :case OP_CB_WANTS_CANCELLED :
@@ -688,6 +708,11 @@ static struct callback_op callback_ops[] = { .encode_res = (callback_encode_res_t)encode_cb_sequence_res, .res_maxsize = CB_OP_SEQUENCE_RES_MAXSZ, }, + [OP_CB_RECALL_ANY] = { + .process_op = (callback_process_op_t)nfs4_callback_recallany, + .decode_args = (callback_decode_arg_t)decode_recallany_args, + .res_maxsize = CB_OP_RECALLANY_RES_MAXSZ, + },#endif /* CONFIG_NFS_V4_1 */ };
fs/nfs/delegation.h +1 -0
@@ -40,6 +40,7 @@ void nfs_inode_return_delegation_noreclaim(struct inode *inode);struct inode *nfs_delegation_find_inode (struct nfs_client *clp,const struct nfs_fh *fhandle);void nfs_super_return_all_delegations (struct super_block *sb);void nfs_expire_all_delegations (struct nfs_client *clp); +void nfs_expire_all_delegation_types (struct nfs_client *clp,fmode_t flags);void nfs_expire_unreferenced_delegations (struct nfs_client *clp);void nfs_handle_cb_pathdown (struct nfs_client *clp);void nfs_client_return_marked_delegations (struct nfs_client *clp);
Signature · 1 line
1.6.2.5
PATCH 7/10 nfs41: check if session exists and if it is persistent
--- fs/nfs/internal.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
fs/nfs/internal.h +9 -0
@@ -30,6 +30,15 @@ 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) +{ +#ifdef CONFIG_NFS_V4_1 +if (nfs4_has_session (clp)) +return (clp->cl_session->flags &SESSION4_PERSIST ); +#endif /* CONFIG_NFS_V4_1 */ +return 0 ; +} +struct nfs_clone_mount {const struct super_block *sb;const struct dentry *dentry;
Signature · 1 line
1.6.2.5
PATCH 8/10 nfs41: add support for the exclusive create flags
In v4.1 the client MUST/SHOULD use the EXCLUSIVE4_1 flag instead of EXCLUSIVE4, and GUARDED when the server supports persistent sessions. For now (and until we support suppattr_exclcreat), we don't send any attributes with EXCLUSIVE4_1 relying in the subsequent SETATTR as in v4.0
--- fs/nfs/nfs4proc.c | 12 +++++++++--- fs/nfs/nfs4xdr.c | 23 ++++++++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-)
fs/nfs/nfs4proc.c +9 -3
@@ -720,9 +720,15 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct path *path, p->o_arg.bitmask = server->attr_bitmask; p->o_arg.claim =NFS4_OPEN_CLAIM_NULL ;if (flags &O_EXCL ) { -u32 *s = (u32 *) p->o_arg.u.verifier.data; - s[0 ] = jiffies; - s[1 ] = current->pid; +if (nfs4_has_persistent_session (server->nfs_client)) { +/* GUARDED */ + p->o_arg.u.attrs = &p->attrs; +memcpy (&p->attrs, attrs,sizeof (p->attrs)); + }else {/* EXCLUSIVE4_1 */ +u32 *s = (u32 *) p->o_arg.u.verifier.data; + s[0 ] = jiffies; + s[1 ] = current->pid; + } }else if (flags &O_CREAT ) { p->o_arg.u.attrs = &p->attrs;memcpy (&p->attrs, attrs,sizeof (p->attrs));
fs/nfs/nfs4xdr.c +20 -3
@@ -52,6 +52,7 @@#include <linux/nfs_fs.h> #include <linux/nfs_idmap.h> #include "nfs4_fs.h" +#include "internal.h" #define NFSDBG_FACILITY NFSDBG_XDR
@@ -135,7 +136,7 @@ static int nfs4_stat_to_errno(int);#define decode_lookup_maxsz (op_decode_hdr_maxsz)#define encode_share_access_maxsz \ (2) -#define encode_createmode_maxsz (1 + encode_attrs_maxsz) +#define encode_createmode_maxsz (1 + encode_attrs_maxsz + encode_verifier_maxsz)#define encode_opentype_maxsz (1 + encode_createmode_maxsz)#define encode_claim_null_maxsz (1 + nfs4_name_maxsz)#define encode_open_maxsz (op_encode_hdr_maxsz + \
@@ -1154,6 +1155,7 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_openastatic inline void encode_createmode (struct xdr_stream *xdr,const struct nfs_openargs *arg) {__be32 *p; +struct nfs_client *clp; p =reserve_space (xdr,4 );switch (arg->open_flags &O_EXCL ) {
@@ -1162,8 +1164,23 @@ static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_opencode_attrs (xdr, arg->u.attrs, arg->server);break ;default : - *p =cpu_to_be32 (NFS4_CREATE_EXCLUSIVE ); -encode_nfs4_verifier (xdr, &arg->u.verifier); + clp = arg->server->nfs_client; +if (clp->cl_minorversion >0 ) { +if (nfs4_has_persistent_session (clp)) { + *p =cpu_to_be32 (NFS4_CREATE_GUARDED ); +encode_attrs (xdr, arg->u.attrs, arg->server); + }else { +struct iattr dummy; + + *p =cpu_to_be32 (NFS4_CREATE_EXCLUSIVE4_1 ); +encode_nfs4_verifier (xdr, &arg->u.verifier); + dummy.ia_valid =0 ; +encode_attrs (xdr, &dummy, arg->server); + } + }else { + *p =cpu_to_be32 (NFS4_CREATE_EXCLUSIVE ); +encode_nfs4_verifier (xdr, &arg->u.verifier); + } } }
Signature · 1 line
1.6.2.5
PATCH 9/10 nfs41: remove server-only EXCHGID4_FLAG_CONFIRMED_R flag from exchange_id
--- fs/nfs/nfs4proc.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
fs/nfs/nfs4proc.c +3 -0
@@ -4324,6 +4324,9 @@ static int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)dprintk ("--> %s\n" , __func__);BUG_ON (clp ==NULL ); +if (args.flags &EXCHGID4_FLAG_CONFIRMED_R ) + args.flags ^=EXCHGID4_FLAG_CONFIRMED_R ; + p = (u32 *)verifier.data; *p++ =htonl ((u32 )clp->cl_boot_time.tv_sec); *p =htonl ((u32 )clp->cl_boot_time.tv_nsec);
Signature · 1 line
1.6.2.5
PATCH 10/10 nfs41: check SEQUENCE status flag
the server can indicate a number of error conditions by setting the appropriate bits in the SEQUENCE operation. The client re-establishes state with the server when it receives one of those, with the action depending on the specific case.
--- fs/nfs/nfs4_fs.h | 1 + fs/nfs/nfs4proc.c | 2 ++ fs/nfs/nfs4state.c | 22 ++++++++++++++++++++++ fs/nfs/nfs4xdr.c | 4 ++-- include/linux/nfs4.h | 2 ++ include/linux/nfs_xdr.h | 1 + 6 files changed, 30 insertions(+), 2 deletions(-)
fs/nfs/nfs4_fs.h +1 -0
@@ -267,6 +267,7 @@ extern void nfs4_state_set_mode_locked(struct nfs4_state *, fmode_t);extern void nfs4_schedule_state_recovery (struct nfs_client *);extern void nfs4_schedule_state_manager (struct nfs_client *);extern int nfs4_state_mark_reclaim_nograce (struct nfs_client *clp,struct nfs4_state *state); +extern void nfs41_handle_sequence_flag_errors (struct nfs_client *clp,u32 flags);extern void nfs4_put_lock_state (struct nfs4_lock_state *lsp);extern int nfs4_set_lock_state (struct nfs4_state *state,struct file_lock *fl);extern void nfs4_copy_stateid (nfs4_stateid *,struct nfs4_state *,fl_owner_t );
fs/nfs/nfs4proc.c +2 -0
@@ -388,6 +388,8 @@ static void nfs41_sequence_done(struct nfs_client *clp,if (time_before (clp->cl_last_renewal, timestamp)) clp->cl_last_renewal = timestamp;spin_unlock (&clp->cl_lock); +/* Check sequence flags */ +nfs41_handle_sequence_flag_errors (clp, res->sr_status_flags);return ; } out:
fs/nfs/nfs4state.c +22 -0
@@ -1151,6 +1151,28 @@ static int nfs4_reclaim_lease(struct nfs_client *clp) }#ifdef CONFIG_NFS_V4_1 +void nfs41_handle_sequence_flag_errors (struct nfs_client *clp,u32 flags) +{ +if (!flags) +return ; +else if (flags &SEQ4_STATUS_RESTART_RECLAIM_NEEDED ) { +set_bit (NFS4CLNT_LEASE_EXPIRED , &clp->cl_state); +nfs4_state_start_reclaim_reboot (clp); +nfs4_schedule_state_recovery (clp); + }else if (flags & (SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED | +SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED | +SEQ4_STATUS_ADMIN_STATE_REVOKED | +SEQ4_STATUS_RECALLABLE_STATE_REVOKED | +SEQ4_STATUS_LEASE_MOVED )) { +set_bit (NFS4CLNT_LEASE_EXPIRED , &clp->cl_state); +nfs4_state_start_reclaim_nograce (clp); +nfs4_schedule_state_recovery (clp); + }else if (flags & (SEQ4_STATUS_CB_PATH_DOWN | +SEQ4_STATUS_BACKCHANNEL_FAULT | +SEQ4_STATUS_CB_PATH_DOWN_SESSION )) +nfs_expire_all_delegations (clp); +} +static void nfs4_session_recovery_handle_error (struct nfs_client *clp,int err) {switch (err) {
fs/nfs/nfs4xdr.c +2 -2
@@ -4614,8 +4614,8 @@ static int decode_sequence(struct xdr_stream *xdr, dummy =be32_to_cpup (p++);/* target highest slot id - currently not processed */ dummy =be32_to_cpup (p++); -/* result flags - currently not processed */ - dummy =be32_to_cpup (p); +/* result flags */ + res->sr_status_flags =be32_to_cpup (p); status =0 ; out_err: res->sr_status = status;
include/linux/nfs4.h +2 -0
@@ -128,6 +128,8 @@#define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040#define SEQ4_STATUS_LEASE_MOVED 0x00000080#define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100 +#define SEQ4_STATUS_CB_PATH_DOWN_SESSION 0x00000200 +#define SEQ4_STATUS_BACKCHANNEL_FAULT 0x00000400#define NFS4_MAX_UINT64 (~(u64)0)
include/linux/nfs_xdr.h +1 -0
@@ -172,6 +172,7 @@ struct nfs4_sequence_res {u8 sr_slotid;/* slot used to send request */ unsigned long sr_renewal_time;int sr_status;/* sequence operation status */ +u32 sr_status_flags; };struct nfs4_get_lease_time_args {
Signature · 1 line
1.6.2.5
Re: [PATCH 05/10] nfs4: return/expire delegations depending on their type
In reply to Alexandros BatsakisQuoted 14 lines · Alexandros Batsakis
Signed-off-by Alexandros Batsakis <[email protected]>--- fs/nfs/delegation.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-)fs/nfs/delegation.c +0
-1@@ -371,29 +371,41 @@ void nfs_super_return_all_delegations(struct super_block *sb)nfs_client_return_marked_delegations (clp); } -static void nfs_client_mark_return_all_delegations (struct nfs_client *clp)
fs/nfs/delegation.c void nfs_super_return_all_delegations(struct super_block *sb) · line 382
Quoted 10 lines
fs/nfs/delegation.c +4
-1+static +void nfs_client_mark_return_all_delegation_types (struct nfs_client *clp,fmode_t flags) {struct nfs_delegation *delegation;rcu_read_lock ();list_for_each_entry_rcu (delegation, &clp->cl_delegations, super_list) { -nfs_mark_return_delegation (clp, delegation); +if (delegation->type & flags) +nfs_mark_return_delegation (clp, delegation);
This will be confusing. In all other parts of the code, we label write delegations as FMODE_READ|FMODE_WRITE, since a write delegation implies a read delegation too.
Quoted 7 lines
fs/nfs/delegation.c +3
-0}rcu_read_unlock (); } +static void nfs_client_mark_return_all_delegations (struct nfs_client *clp) +{ +nfs_client_mark_return_all_delegation_types (clp,FMODE_READ |FMODE_WRITE );
fs/nfs/delegation.c void nfs_super_return_all_delegations(struct super_block *sb) · line 398
Quoted 10 lines
fs/nfs/delegation.c +3
-1+} +static void nfs_delegation_run_state_manager (struct nfs_client *clp) {if (test_bit (NFS4CLNT_DELEGRETURN , &clp->cl_state))nfs4_schedule_state_manager (clp); } -void nfs_expire_all_delegations (struct nfs_client *clp) +void nfs_expire_all_delegation_types (struct nfs_client *clp,fmode_t flags)
Should be static void since there is no declaration of nfs_expire_all_delegation types in any header files (that only appears in patch 07/10).
Quoted 14 lines
fs/nfs/delegation.c +6
-1{ -nfs_client_mark_return_all_delegations (clp); +nfs_client_mark_return_all_delegation_types (clp, flags);nfs_delegation_run_state_manager (clp); } +void nfs_expire_all_delegations (struct nfs_client *clp) +{ +nfs_expire_all_delegation_types (clp,FMODE_READ |FMODE_WRITE ); +} +/* * Return all delegations following an NFS4ERR_CB_PATH_DOWN error. */
Re: [PATCH 03/10] nfs41: fix cb_recall bug
In reply to Alexandros BatsakisQuoted 26 lines · Alexandros Batsakis
in NFSv4.1 the seqid part of a stateid in
CB_RECALLmust be 0Signed-off-by Alexandros Batsakis <[email protected]>--- fs/nfs/delegation.c | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-)fs/nfs/delegation.c +4
-4@@ -432,18 +432,31 @@ int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *s {struct nfs_client *clp =NFS_SERVER (inode)->nfs_client;struct nfs_delegation *delegation; +u32 seqid_len =0 ;rcu_read_lock (); delegation =rcu_dereference (NFS_I (inode)->delegation); -if (delegation ==NULL ||memcmp (delegation->stateid.data, stateid->data, -sizeof (delegation->stateid.data)) !=0 ) { -rcu_read_unlock (); -return -ENOENT ; +if (delegation ==NULL ) + goto enoent; +
fs/nfs/delegation.c int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *s · line 451
Quoted 10 lines
fs/nfs/delegation.c +9
-0+if (clp->cl_minorversion >0 ) { +if (((u32 *) &stateid->data)[0 ] !=0 ) + goto enoent; + seqid_len =4 ; } + +if (memcmp (&delegation->stateid.data[seqid_len], + &stateid->data[seqid_len], +sizeof (stateid->data)-seqid_len)) + goto enoent;
cl_minorversion has nothing to do with generic delegation code. Please just let the comparison be a pointer-to-function argument to nfs_async_inode_return_delegation.
Quoted 11 lines
fs/nfs/delegation.c +4
-0+nfs_mark_return_delegation (clp, delegation);rcu_read_unlock ();nfs_delegation_run_state_manager (clp);return 0 ; +enoent: +rcu_read_unlock (); +return -ENOENT ; }/*
Quoted 17 lines · Alexandros Batsakis
The v4.1 client should take into account the desired rsize, wsize when negotiating the max size in
CREATE_SESSION. Accordingly, it should use rsize, wsize that are smaller than the session negotiated values.Signed-off-by Alexandros Batsakis <[email protected]>--- fs/nfs/client.c | 14 ++++++++++---- fs/nfs/internal.h | 4 ++++ fs/nfs/nfs4proc.c | 7 +++++-- fs/nfs/nfs4xdr.c | 14 ++++++++++++++ 4 files changed, 33 insertions(+), 6 deletions(-)fs/nfs/client.c +0
-0
fs/nfs/client.c static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo * · line 917
Quoted 9 lines
fs/nfs/client.c +4
-2@@ -911,8 +911,10 @@ static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo * server->maxfilesize = fsinfo->maxfilesize; -/* We're airborne Set socket buffersize */ -rpc_setbufsize (server->client, server->wsize +100 , server->rsize +100 ); +/* We're airborne Set socket buffersize. */ +if (!nfs4_has_session (server->nfs_client)) +rpc_setbufsize (server->client, server->wsize +100 , + server->rsize +100 );
Just out of curiosity, 100? Why 100 and not some other number? (I do realize that this wasn't changed, but huh? Magic numbers like this are a bad thing...)
Thanx... ps
Quoted 90 lines
fs/nfs/client.c +6
-2}/* @@ -1260,10 +1262,14 @@ error:static void nfs4_session_set_rwsize (struct nfs_server *server) {#ifdef CONFIG_NFS_V4_1 +struct nfs4_session *sess;if (!nfs4_has_session (server->nfs_client))return ; - server->rsize = server->nfs_client->cl_session->fc_attrs.max_resp_sz; - server->wsize = server->nfs_client->cl_session->fc_attrs.max_rqst_sz; + sess = server->nfs_client->cl_session; + server->rsize = sess->fc_attrs.max_resp_sz - nfs41_maxread_overhead; + server->wsize = sess->fc_attrs.max_rqst_sz - nfs41_maxwrite_overhead; +rpc_setbufsize (server->client, sess->fc_attrs.max_rqst_sz, + sess->fc_attrs.max_resp_sz);#endif /* CONFIG_NFS_V4_1 */ }fs/nfs/internal.h +4
-0@@ -195,6 +195,10 @@ static inline void nfs4_restart_rpc(struct rpc_task *task,#ifdef CONFIG_NFS_V4 extern __be32 *nfs4_decode_dirent (__be32 *p,struct nfs_entry *entry,int plus);#endif +#ifdef CONFIG_NFS_V4_1 +extern const u32 nfs41_maxread_overhead; +extern const u32 nfs41_maxwrite_overhead; +#endif /* nfs4proc.c */ #ifdef CONFIG_NFS_V4 fs/nfs/nfs4proc.c +5
-2@@ -4827,13 +4827,16 @@ int nfs4_proc_destroy_session(struct nfs4_session *session)int nfs4_init_session (struct nfs_server *server) {struct nfs_client *clp = server->nfs_client; +struct nfs4_session *session;int ret;if (!nfs4_has_session (clp))return 0 ; - clp->cl_session->fc_attrs.max_rqst_sz = server->wsize; - clp->cl_session->fc_attrs.max_resp_sz = server->rsize; + session = clp->cl_session; + session->fc_attrs.max_rqst_sz = server->wsize + nfs41_maxwrite_overhead; + session->fc_attrs.max_resp_sz = server->rsize + nfs41_maxread_overhead; + ret =nfs4_recover_expired_lease (server);if (!ret) ret =nfs4_check_client_ready (clp);fs/nfs/nfs4xdr.c +14
-0@@ -46,6 +46,7 @@#include <linux/proc_fs.h> #include <linux/kdev_t.h> #include <linux/sunrpc/clnt.h> +#include <linux/sunrpc/msg_prot.h> #include <linux/nfs.h> #include <linux/nfs4.h> #include <linux/nfs_fs.h> @@ -676,6 +677,19 @@ static int nfs4_stat_to_errno(int); decode_sequence_maxsz + \ decode_putrootfh_maxsz + \ decode_fsinfo_maxsz) + +const u32 nfs41_maxwrite_overhead = ((RPC_MAX_HEADER_WITH_AUTH + + compound_encode_hdr_maxsz + + encode_sequence_maxsz + + encode_putfh_maxsz + + encode_getattr_maxsz) * +XDR_UNIT ); + +const u32 nfs41_maxread_overhead = ((RPC_MAX_HEADER_WITH_AUTH + + compound_decode_hdr_maxsz + + decode_sequence_maxsz + + decode_putfh_maxsz) * +XDR_UNIT );#endif /* CONFIG_NFS_V4_1 */ static const umode_t nfs_type2fmt[] = {
Quoted 17 lines · Alexandros Batsakis
The v4.1 client should take into account the desired rsize, wsize when negotiating the max size in
CREATE_SESSION. Accordingly, it should use rsize, wsize that are smaller than the session negotiated values.Signed-off-by Alexandros Batsakis <[email protected]>--- fs/nfs/client.c | 14 ++++++++++---- fs/nfs/internal.h | 4 ++++ fs/nfs/nfs4proc.c | 7 +++++-- fs/nfs/nfs4xdr.c | 14 ++++++++++++++ 4 files changed, 33 insertions(+), 6 deletions(-)fs/nfs/client.c +0
-0
fs/nfs/client.c static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo * · line 918
Quoted 10 lines
fs/nfs/client.c +4
-2@@ -911,8 +911,10 @@ static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo * server->maxfilesize = fsinfo->maxfilesize; -/* We're airborne Set socket buffersize */ -rpc_setbufsize (server->client, server->wsize +100 , server->rsize +100 ); +/* We're airborne Set socket buffersize. */ +if (!nfs4_has_session (server->nfs_client)) +rpc_setbufsize (server->client, server->wsize +100 , + server->rsize +100 ); }
Please move this out of generic NFS code.
I really don't like this ugly proliferation of 'if (nfs4_has_session())' that appears to be creeping into every single function in the NFS client code.
fs/nfs/client.c error: · line 1270
Quoted 13 lines
fs/nfs/client.c +4
-2/* @@ -1260,10 +1262,14 @@ error:static void nfs4_session_set_rwsize (struct nfs_server *server) {#ifdef CONFIG_NFS_V4_1 +struct nfs4_session *sess;if (!nfs4_has_session (server->nfs_client))return ; - server->rsize = server->nfs_client->cl_session->fc_attrs.max_resp_sz; - server->wsize = server->nfs_client->cl_session->fc_attrs.max_rqst_sz; + sess = server->nfs_client->cl_session; + server->rsize = sess->fc_attrs.max_resp_sz - nfs41_maxread_overhead; + server->wsize = sess->fc_attrs.max_rqst_sz - nfs41_maxwrite_overhead;
For one thing, the r/wsize is conventionally set to be a power of 2, since most disks have block sizes of that form.
Secondly, what if the server has given you a max_resp_sz/max_rqst_sz that is larger than what you asked for?
fs/nfs/client.c error: · line 1272
Quoted 2 lines
fs/nfs/client.c +2
-0+rpc_setbufsize (server->client, sess->fc_attrs.max_rqst_sz, + sess->fc_attrs.max_resp_sz);
Is anyone ever going to use NFSv4.1 over UDP?
Quoted 80 lines
fs/nfs/client.c +0
-0#endif /* CONFIG_NFS_V4_1 */ }fs/nfs/internal.h +4
-0@@ -195,6 +195,10 @@ static inline void nfs4_restart_rpc(struct rpc_task *task,#ifdef CONFIG_NFS_V4 extern __be32 *nfs4_decode_dirent (__be32 *p,struct nfs_entry *entry,int plus);#endif +#ifdef CONFIG_NFS_V4_1 +extern const u32 nfs41_maxread_overhead; +extern const u32 nfs41_maxwrite_overhead; +#endif /* nfs4proc.c */ #ifdef CONFIG_NFS_V4 fs/nfs/nfs4proc.c +5
-2@@ -4827,13 +4827,16 @@ int nfs4_proc_destroy_session(struct nfs4_session *session)int nfs4_init_session (struct nfs_server *server) {struct nfs_client *clp = server->nfs_client; +struct nfs4_session *session;int ret;if (!nfs4_has_session (clp))return 0 ; - clp->cl_session->fc_attrs.max_rqst_sz = server->wsize; - clp->cl_session->fc_attrs.max_resp_sz = server->rsize; + session = clp->cl_session; + session->fc_attrs.max_rqst_sz = server->wsize + nfs41_maxwrite_overhead; + session->fc_attrs.max_resp_sz = server->rsize + nfs41_maxread_overhead; + ret =nfs4_recover_expired_lease (server);if (!ret) ret =nfs4_check_client_ready (clp);fs/nfs/nfs4xdr.c +14
-0@@ -46,6 +46,7 @@#include <linux/proc_fs.h> #include <linux/kdev_t.h> #include <linux/sunrpc/clnt.h> +#include <linux/sunrpc/msg_prot.h> #include <linux/nfs.h> #include <linux/nfs4.h> #include <linux/nfs_fs.h> @@ -676,6 +677,19 @@ static int nfs4_stat_to_errno(int); decode_sequence_maxsz + \ decode_putrootfh_maxsz + \ decode_fsinfo_maxsz) + +const u32 nfs41_maxwrite_overhead = ((RPC_MAX_HEADER_WITH_AUTH + + compound_encode_hdr_maxsz + + encode_sequence_maxsz + + encode_putfh_maxsz + + encode_getattr_maxsz) * +XDR_UNIT ); + +const u32 nfs41_maxread_overhead = ((RPC_MAX_HEADER_WITH_AUTH + + compound_decode_hdr_maxsz + + decode_sequence_maxsz + + decode_putfh_maxsz) * +XDR_UNIT );#endif /* CONFIG_NFS_V4_1 */ static const umode_t nfs_type2fmt[] = {Signature · 6 lines
1.6.2.5 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected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lci5rZXJuZWwub3JnL21ham9yZG9tby1pbmZvLmh0 bWwNCg==
Quoted 53 lines · Trond Myklebust
Quoted 17 lines · Alexandros Batsakis
The v4.1 client should take into account the desired rsize, wsize when negotiating the max size in
CREATE_SESSION. Accordingly, it should use rsize, wsize that are smaller than the session negotiated values.Signed-off-by Alexandros Batsakis <[email protected]>--- fs/nfs/client.c | 14 ++++++++++---- fs/nfs/internal.h | 4 ++++ fs/nfs/nfs4proc.c | 7 +++++-- fs/nfs/nfs4xdr.c | 14 ++++++++++++++ 4 files changed, 33 insertions(+), 6 deletions(-)fs/nfs/client.c +0
-0fs/nfs/client.c static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo * · line 918
Quoted 10 lines
fs/nfs/client.c +4
-2@@ -911,8 +911,10 @@ static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo * server->maxfilesize = fsinfo->maxfilesize; -/* We're airborne Set socket buffersize */ -rpc_setbufsize (server->client, server->wsize +100 , server->rsize +100 ); +/* We're airborne Set socket buffersize. */ +if (!nfs4_has_session (server->nfs_client)) +rpc_setbufsize (server->client, server->wsize +100 , + server->rsize +100 ); }Please move this out of generic NFS code.
I really don't like this ugly proliferation of 'if (
nfs4_has_session())' that appears to be creeping into every single function in the NFS client code.fs/nfs/client.c error: · line 1270
Quoted 13 lines
fs/nfs/client.c +4
-2/* @@ -1260,10 +1262,14 @@ error:static void nfs4_session_set_rwsize (struct nfs_server *server) {#ifdef CONFIG_NFS_V4_1 +struct nfs4_session *sess;if (!nfs4_has_session (server->nfs_client))return ; - server->rsize = server->nfs_client->cl_session->fc_attrs.max_resp_sz; - server->wsize = server->nfs_client->cl_session->fc_attrs.max_rqst_sz; + sess = server->nfs_client->cl_session; + server->rsize = sess->fc_attrs.max_resp_sz - nfs41_maxread_overhead; + server->wsize = sess->fc_attrs.max_rqst_sz - nfs41_maxwrite_overhead;For one thing, the r/wsize is conventionally set to be a power of 2, since most disks have block sizes of that form.
Quoted 8 lines
Secondly, what if the server has given you a max_resp_sz/max_rqst_sz that is larger than what you asked for?
fs/nfs/client.c error: · line 1272
Quoted 2 lines
fs/nfs/client.c +2
-0+rpc_setbufsize (server->client, sess->fc_attrs.max_rqst_sz, + sess->fc_attrs.max_resp_sz);Is anyone ever going to use NFSv4.1 over UDP?
I thought that NFSv4 over UDP was outlawed because UDP, as a transport, did not offer the correct set of semantics required. I know that the Linux NFSv4 server registers NFSv4 over UDP, but I don't know of any other servers which do.
I was going to file a bug and a patch to stop NFSv4 from being transported over UDP. :-)
Thanx... ps
Quoted 87 lines
Quoted 80 lines
fs/nfs/client.c +0
-0#endif /* CONFIG_NFS_V4_1 */ }fs/nfs/internal.h +4
-0@@ -195,6 +195,10 @@ static inline void nfs4_restart_rpc(struct rpc_task *task,#ifdef CONFIG_NFS_V4 extern __be32 *nfs4_decode_dirent (__be32 *p,struct nfs_entry *entry,int plus);#endif +#ifdef CONFIG_NFS_V4_1 +extern const u32 nfs41_maxread_overhead; +extern const u32 nfs41_maxwrite_overhead; +#endif /* nfs4proc.c */ #ifdef CONFIG_NFS_V4 fs/nfs/nfs4proc.c +5
-2@@ -4827,13 +4827,16 @@ int nfs4_proc_destroy_session(struct nfs4_session *session)int nfs4_init_session (struct nfs_server *server) {struct nfs_client *clp = server->nfs_client; +struct nfs4_session *session;int ret;if (!nfs4_has_session (clp))return 0 ; - clp->cl_session->fc_attrs.max_rqst_sz = server->wsize; - clp->cl_session->fc_attrs.max_resp_sz = server->rsize; + session = clp->cl_session; + session->fc_attrs.max_rqst_sz = server->wsize + nfs41_maxwrite_overhead; + session->fc_attrs.max_resp_sz = server->rsize + nfs41_maxread_overhead; + ret =nfs4_recover_expired_lease (server);if (!ret) ret =nfs4_check_client_ready (clp);fs/nfs/nfs4xdr.c +14
-0@@ -46,6 +46,7 @@#include <linux/proc_fs.h> #include <linux/kdev_t.h> #include <linux/sunrpc/clnt.h> +#include <linux/sunrpc/msg_prot.h> #include <linux/nfs.h> #include <linux/nfs4.h> #include <linux/nfs_fs.h> @@ -676,6 +677,19 @@ static int nfs4_stat_to_errno(int); decode_sequence_maxsz + \ decode_putrootfh_maxsz + \ decode_fsinfo_maxsz) + +const u32 nfs41_maxwrite_overhead = ((RPC_MAX_HEADER_WITH_AUTH + + compound_encode_hdr_maxsz + + encode_sequence_maxsz + + encode_putfh_maxsz + + encode_getattr_maxsz) * +XDR_UNIT ); + +const u32 nfs41_maxread_overhead = ((RPC_MAX_HEADER_WITH_AUTH + + compound_decode_hdr_maxsz + + decode_sequence_maxsz + + decode_putfh_maxsz) * +XDR_UNIT );#endif /* CONFIG_NFS_V4_1 */ static const umode_t nfs_type2fmt[] = {Signature · 6 lines
1.6.2.5 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Peter Staubach
Quoted 3 lines · Trond Myklebust
Is anyone ever going to use NFSv4.1 over UDP?
Quoted 8 lines
I thought that NFSv4 over UDP was outlawed because UDP, as a transport, did not offer the correct set of semantics required. I know that the Linux NFSv4 server registers NFSv4 over UDP, but I don't know of any other servers which do.
I was going to file a bug and a patch to stop NFSv4 from being transported over UDP. :-)
OK by me.--b.