NFS: Zero-stateid SETATTR should first return delegation
authorChuck Lever <chuck.lever@oracle.com>
Fri, 4 Sep 2020 21:39:12 +0000 (17:39 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Sep 2020 10:59:50 +0000 (12:59 +0200)
commit7e4b9125c899c9ce555872ff2a6af065f0b2ae26
tree79d4808874d2881cb403885b1a8ad7d896687ecb
parente917cbad17f2f3676bff1a7a49e1929bbba18380
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>
fs/nfs/nfs4proc.c