diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2020-09-04 17:39:12 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-09-23 12:10:58 +0200 |
commit | a6a2cf4d918f3c62b652a87d4e9b667049de4cb1 (patch) | |
tree | c8fc618dba52237ece254abf89ff6a519154e453 /fs/nfs | |
parent | 09ca2d2681e95c7603ce1c3601ebbeaaf8415750 (diff) | |
download | linux-stable-a6a2cf4d918f3c62b652a87d4e9b667049de4cb1.tar.gz linux-stable-a6a2cf4d918f3c62b652a87d4e9b667049de4cb1.tar.bz2 linux-stable-a6a2cf4d918f3c62b652a87d4e9b667049de4cb1.zip |
NFS: Zero-stateid SETATTR should first return delegation
[ Upstream commit 644c9f40cf71969f29add32f32349e71d4995c0b ]
If a write delegation isn't available, the Linux NFS client uses
a zero-stateid when performing a SETATTR.
NFSv4.0 provides no mechanism for an NFS server to match such a
request to a particular client. It recalls all delegations for that
file, even delegations held by the client issuing the request. If
that client happens to hold a read delegation, the server will
recall it immediately, resulting in an NFS4ERR_DELAY/CB_RECALL/
DELEGRETURN sequence.
Optimize out this pipeline bubble by having the client return any
delegations it may hold on a file before it issues a
SETATTR(zero-stateid) on that file.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs4proc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 929f1d72bfd3..b2a2ff3f22a4 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3129,8 +3129,10 @@ static int _nfs4_do_setattr(struct inode *inode, /* Servers should only apply open mode checks for file size changes */ truncate = (arg->iap->ia_valid & ATTR_SIZE) ? true : false; - if (!truncate) + if (!truncate) { + nfs4_inode_make_writeable(inode); goto zero_stateid; + } if (nfs4_copy_delegation_stateid(inode, FMODE_WRITE, &arg->stateid, &delegation_cred)) { /* Use that stateid */ |