@@ -127,7 +127,6 @@ static void free_session(struct nfsd4_session *);
127
127
128
128
static const struct nfsd4_callback_ops nfsd4_cb_recall_ops ;
129
129
static const struct nfsd4_callback_ops nfsd4_cb_notify_lock_ops ;
130
- static const struct nfsd4_callback_ops nfsd4_cb_getattr_ops ;
131
130
132
131
static struct workqueue_struct * laundry_wq ;
133
132
@@ -1190,10 +1189,6 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_file *fp,
1190
1189
dp -> dl_recalled = false;
1191
1190
nfsd4_init_cb (& dp -> dl_recall , dp -> dl_stid .sc_client ,
1192
1191
& 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 ;
1197
1192
get_nfs4_file (fp );
1198
1193
dp -> dl_stid .sc_file = fp ;
1199
1194
return dp ;
@@ -2901,56 +2896,11 @@ nfsd4_cb_recall_any_release(struct nfsd4_callback *cb)
2901
2896
spin_unlock (& nn -> client_lock );
2902
2897
}
2903
2898
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
-
2933
2899
static const struct nfsd4_callback_ops nfsd4_cb_recall_any_ops = {
2934
2900
.done = nfsd4_cb_recall_any_done ,
2935
2901
.release = nfsd4_cb_recall_any_release ,
2936
2902
};
2937
2903
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
-
2954
2904
static struct nfs4_client * create_client (struct xdr_netobj name ,
2955
2905
struct svc_rqst * rqstp , nfs4_verifier * verf )
2956
2906
{
@@ -5686,8 +5636,6 @@ nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
5686
5636
struct svc_fh * parent = NULL ;
5687
5637
int cb_up ;
5688
5638
int status = 0 ;
5689
- struct kstat stat ;
5690
- struct path path ;
5691
5639
5692
5640
cb_up = nfsd4_cb_channel_good (oo -> oo_owner .so_client );
5693
5641
open -> op_recall = false;
@@ -5725,18 +5673,6 @@ nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
5725
5673
if (open -> op_share_access & NFS4_SHARE_ACCESS_WRITE ) {
5726
5674
open -> op_delegate_type = NFS4_OPEN_DELEGATE_WRITE ;
5727
5675
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 ));
5740
5676
} else {
5741
5677
open -> op_delegate_type = NFS4_OPEN_DELEGATE_READ ;
5742
5678
trace_nfsd_deleg_read (& dp -> dl_stid .sc_stateid );
@@ -8489,8 +8425,6 @@ nfsd4_get_writestateid(struct nfsd4_compound_state *cstate,
8489
8425
* nfsd4_deleg_getattr_conflict - Recall if GETATTR causes conflict
8490
8426
* @rqstp: RPC transaction context
8491
8427
* @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
8494
8428
*
8495
8429
* This function is called when there is a conflict between a write
8496
8430
* delegation and a change/size GETATTR from another client. The server
@@ -8499,23 +8433,21 @@ nfsd4_get_writestateid(struct nfsd4_compound_state *cstate,
8499
8433
* delegation before replying to the GETATTR. See RFC 8881 section
8500
8434
* 18.7.4.
8501
8435
*
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
+ *
8502
8440
* Returns 0 if there is no conflict; otherwise an nfs_stat
8503
8441
* code is returned.
8504
8442
*/
8505
8443
__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 )
8508
8445
{
8446
+ __be32 status ;
8509
8447
struct file_lock_context * ctx ;
8510
- struct nfs4_delegation * dp ;
8511
- struct nfs4_cb_fattr * ncf ;
8512
8448
struct file_lock * fl ;
8513
- struct iattr attrs ;
8514
- __be32 status ;
8515
-
8516
- might_sleep ();
8449
+ struct nfs4_delegation * dp ;
8517
8450
8518
- * modified = false;
8519
8451
ctx = locks_inode_context (inode );
8520
8452
if (!ctx )
8521
8453
return 0 ;
@@ -8542,34 +8474,10 @@ nfsd4_deleg_getattr_conflict(struct svc_rqst *rqstp, struct inode *inode,
8542
8474
break_lease :
8543
8475
spin_unlock (& ctx -> flc_lock );
8544
8476
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 ;
8573
8481
return 0 ;
8574
8482
}
8575
8483
break ;
0 commit comments