If a write delegation isn't available, the Linux NFS client uses a zero-stateid when performing a SETATTR. If that client happens to hold a read delegation, the server will recall it immediately, resulting in a short delay while the CB_RECALL operation is done. Optimize out this delay by having the client return any delegation it may hold on a file before issuing a SETATTR(zero-stateid) on that file. Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> --- fs/nfs/nfs4proc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index dbd01548335b..53a56250cf4b 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3314,6 +3314,7 @@ static int _nfs4_do_setattr(struct inode *inode, goto zero_stateid; } else { zero_stateid: + nfs4_inode_return_delegation(inode); nfs4_stateid_copy(&arg->stateid, &zero_stateid); } if (delegation_cred)