@@ -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{
@@ -5685,8 +5635,6 @@ nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
56855635 struct svc_fh * parent = NULL ;
56865636 int cb_up ;
56875637 int status = 0 ;
5688- struct kstat stat ;
5689- struct path path ;
56905638
56915639 cb_up = nfsd4_cb_channel_good (oo -> oo_owner .so_client );
56925640 open -> op_recall = false;
@@ -5724,18 +5672,6 @@ nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
57245672 if (open -> op_share_access & NFS4_SHARE_ACCESS_WRITE ) {
57255673 open -> op_delegate_type = NFS4_OPEN_DELEGATE_WRITE ;
57265674 trace_nfsd_deleg_write (& dp -> dl_stid .sc_stateid );
5727- path .mnt = currentfh -> fh_export -> ex_path .mnt ;
5728- path .dentry = currentfh -> fh_dentry ;
5729- if (vfs_getattr (& path , & stat ,
5730- (STATX_SIZE | STATX_CTIME | STATX_CHANGE_COOKIE ),
5731- AT_STATX_SYNC_AS_STAT )) {
5732- nfs4_put_stid (& dp -> dl_stid );
5733- destroy_delegation (dp );
5734- goto out_no_deleg ;
5735- }
5736- dp -> dl_cb_fattr .ncf_cur_fsize = stat .size ;
5737- dp -> dl_cb_fattr .ncf_initial_cinfo =
5738- nfsd4_change_attribute (& stat , d_inode (currentfh -> fh_dentry ));
57395675 } else {
57405676 open -> op_delegate_type = NFS4_OPEN_DELEGATE_READ ;
57415677 trace_nfsd_deleg_read (& dp -> dl_stid .sc_stateid );
@@ -8492,8 +8428,6 @@ nfsd4_get_writestateid(struct nfsd4_compound_state *cstate,
84928428 * nfsd4_deleg_getattr_conflict - Recall if GETATTR causes conflict
84938429 * @rqstp: RPC transaction context
84948430 * @inode: file to be checked for a conflict
8495- * @modified: return true if file was modified
8496- * @size: new size of file if modified is true
84978431 *
84988432 * This function is called when there is a conflict between a write
84998433 * delegation and a change/size GETATTR from another client. The server
@@ -8502,23 +8436,21 @@ nfsd4_get_writestateid(struct nfsd4_compound_state *cstate,
85028436 * delegation before replying to the GETATTR. See RFC 8881 section
85038437 * 18.7.4.
85048438 *
8439+ * The current implementation does not support CB_GETATTR yet. However
8440+ * this can avoid recalling the delegation could be added in follow up
8441+ * work.
8442+ *
85058443 * Returns 0 if there is no conflict; otherwise an nfs_stat
85068444 * code is returned.
85078445 */
85088446__be32
8509- nfsd4_deleg_getattr_conflict (struct svc_rqst * rqstp , struct inode * inode ,
8510- bool * modified , u64 * size )
8447+ nfsd4_deleg_getattr_conflict (struct svc_rqst * rqstp , struct inode * inode )
85118448{
8449+ __be32 status ;
85128450 struct file_lock_context * ctx ;
8513- struct nfs4_delegation * dp ;
8514- struct nfs4_cb_fattr * ncf ;
85158451 struct file_lock * fl ;
8516- struct iattr attrs ;
8517- __be32 status ;
8518-
8519- might_sleep ();
8452+ struct nfs4_delegation * dp ;
85208453
8521- * modified = false;
85228454 ctx = locks_inode_context (inode );
85238455 if (!ctx )
85248456 return 0 ;
@@ -8545,34 +8477,10 @@ nfsd4_deleg_getattr_conflict(struct svc_rqst *rqstp, struct inode *inode,
85458477break_lease :
85468478 spin_unlock (& ctx -> flc_lock );
85478479 nfsd_stats_wdeleg_getattr_inc ();
8548-
8549- dp = fl -> fl_owner ;
8550- ncf = & dp -> dl_cb_fattr ;
8551- nfs4_cb_getattr (& dp -> dl_cb_fattr );
8552- wait_on_bit (& ncf -> ncf_cb_flags , CB_GETATTR_BUSY , TASK_INTERRUPTIBLE );
8553- if (ncf -> ncf_cb_status ) {
8554- status = nfserrno (nfsd_open_break_lease (inode , NFSD_MAY_READ ));
8555- if (status != nfserr_jukebox ||
8556- !nfsd_wait_for_delegreturn (rqstp , inode ))
8557- return status ;
8558- }
8559- if (!ncf -> ncf_file_modified &&
8560- (ncf -> ncf_initial_cinfo != ncf -> ncf_cb_change ||
8561- ncf -> ncf_cur_fsize != ncf -> ncf_cb_fsize ))
8562- ncf -> ncf_file_modified = true;
8563- if (ncf -> ncf_file_modified ) {
8564- /*
8565- * The server would not update the file's metadata
8566- * with the client's modified size.
8567- */
8568- attrs .ia_mtime = attrs .ia_ctime = current_time (inode );
8569- attrs .ia_valid = ATTR_MTIME | ATTR_CTIME ;
8570- setattr_copy (& nop_mnt_idmap , inode , & attrs );
8571- mark_inode_dirty (inode );
8572- ncf -> ncf_cur_fsize = ncf -> ncf_cb_fsize ;
8573- * size = ncf -> ncf_cur_fsize ;
8574- * modified = true;
8575- }
8480+ status = nfserrno (nfsd_open_break_lease (inode , NFSD_MAY_READ ));
8481+ if (status != nfserr_jukebox ||
8482+ !nfsd_wait_for_delegreturn (rqstp , inode ))
8483+ return status ;
85768484 return 0 ;
85778485 }
85788486 break ;
0 commit comments