@@ -127,7 +127,6 @@ static void free_session(struct nfsd4_session *);
127127
128128static const struct nfsd4_callback_ops nfsd4_cb_recall_ops ;
129129static const struct nfsd4_callback_ops nfsd4_cb_notify_lock_ops ;
130- static const struct nfsd4_callback_ops nfsd4_cb_getattr_ops ;
131130
132131static struct workqueue_struct * laundry_wq ;
133132
@@ -1190,10 +1189,6 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_file *fp,
11901189 dp -> dl_recalled = false;
11911190 nfsd4_init_cb (& dp -> dl_recall , dp -> dl_stid .sc_client ,
11921191 & nfsd4_cb_recall_ops , NFSPROC4_CLNT_CB_RECALL );
1193- nfsd4_init_cb (& dp -> dl_cb_fattr .ncf_getattr , dp -> dl_stid .sc_client ,
1194- & nfsd4_cb_getattr_ops , NFSPROC4_CLNT_CB_GETATTR );
1195- dp -> dl_cb_fattr .ncf_file_modified = false;
1196- dp -> dl_cb_fattr .ncf_cb_bmap [0 ] = FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE ;
11971192 get_nfs4_file (fp );
11981193 dp -> dl_stid .sc_file = fp ;
11991194 return dp ;
@@ -2901,56 +2896,11 @@ nfsd4_cb_recall_any_release(struct nfsd4_callback *cb)
29012896 spin_unlock (& nn -> client_lock );
29022897}
29032898
2904- static int
2905- nfsd4_cb_getattr_done (struct nfsd4_callback * cb , struct rpc_task * task )
2906- {
2907- struct nfs4_cb_fattr * ncf =
2908- container_of (cb , struct nfs4_cb_fattr , ncf_getattr );
2909-
2910- ncf -> ncf_cb_status = task -> tk_status ;
2911- switch (task -> tk_status ) {
2912- case - NFS4ERR_DELAY :
2913- rpc_delay (task , 2 * HZ );
2914- return 0 ;
2915- default :
2916- return 1 ;
2917- }
2918- }
2919-
2920- static void
2921- nfsd4_cb_getattr_release (struct nfsd4_callback * cb )
2922- {
2923- struct nfs4_cb_fattr * ncf =
2924- container_of (cb , struct nfs4_cb_fattr , ncf_getattr );
2925- struct nfs4_delegation * dp =
2926- container_of (ncf , struct nfs4_delegation , dl_cb_fattr );
2927-
2928- nfs4_put_stid (& dp -> dl_stid );
2929- clear_bit (CB_GETATTR_BUSY , & ncf -> ncf_cb_flags );
2930- wake_up_bit (& ncf -> ncf_cb_flags , CB_GETATTR_BUSY );
2931- }
2932-
29332899static const struct nfsd4_callback_ops nfsd4_cb_recall_any_ops = {
29342900 .done = nfsd4_cb_recall_any_done ,
29352901 .release = nfsd4_cb_recall_any_release ,
29362902};
29372903
2938- static const struct nfsd4_callback_ops nfsd4_cb_getattr_ops = {
2939- .done = nfsd4_cb_getattr_done ,
2940- .release = nfsd4_cb_getattr_release ,
2941- };
2942-
2943- void nfs4_cb_getattr (struct nfs4_cb_fattr * ncf )
2944- {
2945- struct nfs4_delegation * dp =
2946- container_of (ncf , struct nfs4_delegation , dl_cb_fattr );
2947-
2948- if (test_and_set_bit (CB_GETATTR_BUSY , & ncf -> ncf_cb_flags ))
2949- return ;
2950- refcount_inc (& dp -> dl_stid .sc_count );
2951- nfsd4_run_cb (& ncf -> ncf_getattr );
2952- }
2953-
29542904static struct nfs4_client * create_client (struct xdr_netobj name ,
29552905 struct svc_rqst * rqstp , nfs4_verifier * verf )
29562906{
@@ -5686,8 +5636,6 @@ nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
56865636 struct svc_fh * parent = NULL ;
56875637 int cb_up ;
56885638 int status = 0 ;
5689- struct kstat stat ;
5690- struct path path ;
56915639
56925640 cb_up = nfsd4_cb_channel_good (oo -> oo_owner .so_client );
56935641 open -> op_recall = false;
@@ -5725,18 +5673,6 @@ nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
57255673 if (open -> op_share_access & NFS4_SHARE_ACCESS_WRITE ) {
57265674 open -> op_delegate_type = NFS4_OPEN_DELEGATE_WRITE ;
57275675 trace_nfsd_deleg_write (& dp -> dl_stid .sc_stateid );
5728- path .mnt = currentfh -> fh_export -> ex_path .mnt ;
5729- path .dentry = currentfh -> fh_dentry ;
5730- if (vfs_getattr (& path , & stat ,
5731- (STATX_SIZE | STATX_CTIME | STATX_CHANGE_COOKIE ),
5732- AT_STATX_SYNC_AS_STAT )) {
5733- nfs4_put_stid (& dp -> dl_stid );
5734- destroy_delegation (dp );
5735- goto out_no_deleg ;
5736- }
5737- dp -> dl_cb_fattr .ncf_cur_fsize = stat .size ;
5738- dp -> dl_cb_fattr .ncf_initial_cinfo =
5739- nfsd4_change_attribute (& stat , d_inode (currentfh -> fh_dentry ));
57405676 } else {
57415677 open -> op_delegate_type = NFS4_OPEN_DELEGATE_READ ;
57425678 trace_nfsd_deleg_read (& dp -> dl_stid .sc_stateid );
@@ -8489,8 +8425,6 @@ nfsd4_get_writestateid(struct nfsd4_compound_state *cstate,
84898425 * nfsd4_deleg_getattr_conflict - Recall if GETATTR causes conflict
84908426 * @rqstp: RPC transaction context
84918427 * @inode: file to be checked for a conflict
8492- * @modified: return true if file was modified
8493- * @size: new size of file if modified is true
84948428 *
84958429 * This function is called when there is a conflict between a write
84968430 * delegation and a change/size GETATTR from another client. The server
@@ -8499,23 +8433,21 @@ nfsd4_get_writestateid(struct nfsd4_compound_state *cstate,
84998433 * delegation before replying to the GETATTR. See RFC 8881 section
85008434 * 18.7.4.
85018435 *
8436+ * The current implementation does not support CB_GETATTR yet. However
8437+ * this can avoid recalling the delegation could be added in follow up
8438+ * work.
8439+ *
85028440 * Returns 0 if there is no conflict; otherwise an nfs_stat
85038441 * code is returned.
85048442 */
85058443__be32
8506- nfsd4_deleg_getattr_conflict (struct svc_rqst * rqstp , struct inode * inode ,
8507- bool * modified , u64 * size )
8444+ nfsd4_deleg_getattr_conflict (struct svc_rqst * rqstp , struct inode * inode )
85088445{
8446+ __be32 status ;
85098447 struct file_lock_context * ctx ;
8510- struct nfs4_delegation * dp ;
8511- struct nfs4_cb_fattr * ncf ;
85128448 struct file_lock * fl ;
8513- struct iattr attrs ;
8514- __be32 status ;
8515-
8516- might_sleep ();
8449+ struct nfs4_delegation * dp ;
85178450
8518- * modified = false;
85198451 ctx = locks_inode_context (inode );
85208452 if (!ctx )
85218453 return 0 ;
@@ -8542,34 +8474,10 @@ nfsd4_deleg_getattr_conflict(struct svc_rqst *rqstp, struct inode *inode,
85428474break_lease :
85438475 spin_unlock (& ctx -> flc_lock );
85448476 nfsd_stats_wdeleg_getattr_inc ();
8545-
8546- dp = fl -> fl_owner ;
8547- ncf = & dp -> dl_cb_fattr ;
8548- nfs4_cb_getattr (& dp -> dl_cb_fattr );
8549- wait_on_bit (& ncf -> ncf_cb_flags , CB_GETATTR_BUSY , TASK_INTERRUPTIBLE );
8550- if (ncf -> ncf_cb_status ) {
8551- status = nfserrno (nfsd_open_break_lease (inode , NFSD_MAY_READ ));
8552- if (status != nfserr_jukebox ||
8553- !nfsd_wait_for_delegreturn (rqstp , inode ))
8554- return status ;
8555- }
8556- if (!ncf -> ncf_file_modified &&
8557- (ncf -> ncf_initial_cinfo != ncf -> ncf_cb_change ||
8558- ncf -> ncf_cur_fsize != ncf -> ncf_cb_fsize ))
8559- ncf -> ncf_file_modified = true;
8560- if (ncf -> ncf_file_modified ) {
8561- /*
8562- * The server would not update the file's metadata
8563- * with the client's modified size.
8564- */
8565- attrs .ia_mtime = attrs .ia_ctime = current_time (inode );
8566- attrs .ia_valid = ATTR_MTIME | ATTR_CTIME ;
8567- setattr_copy (& nop_mnt_idmap , inode , & attrs );
8568- mark_inode_dirty (inode );
8569- ncf -> ncf_cur_fsize = ncf -> ncf_cb_fsize ;
8570- * size = ncf -> ncf_cur_fsize ;
8571- * modified = true;
8572- }
8477+ status = nfserrno (nfsd_open_break_lease (inode , NFSD_MAY_READ ));
8478+ if (status != nfserr_jukebox ||
8479+ !nfsd_wait_for_delegreturn (rqstp , inode ))
8480+ return status ;
85738481 return 0 ;
85748482 }
85758483 break ;
0 commit comments