A problem observed for some clients is that the list of nfs_server->delegations can grow unweildy, leading to the clients spinning in tight loops walking across delegations that have been marked revoked. These two patches attempt to solve that problem by using the result of FREE_STATEID to clean up the list of delegations, thus keeping that list pruned to an operable size. There's a couple things not to like here: I don't like dropping the const qualifier on the stateid for both the test and free operations. The first patch finishes the mostly complete work of ensuring we're passing a copy. The core issue is that callers can't determine if FREE_STATEID was successful since the operation is folded into test_and_free_stateid(). Another way would be to un-fold the call paths that are combined using test_and_free friends, and that seems worse than just carrying result on the stateid's type. The second thing I don't like with this approach is that it doesn't fix the potential problem that the client should try to make repeated attempts to free a delegation stateid on the server that received an error from FREE_STATEID on the first pass. That's probably a pretty rare thing, but its also something that can keep revoked state around forever potentially creating a never-ending operation loop between client and server. First pass, please criticise, thanks for any comments. Ben Benjamin Coddington (2): NFSv4: Ensure test_and_free_stateid callers use private memory NFSv4: Allow FREE_STATEID to clean up delegations fs/nfs/delegation.c | 25 ++++++++++++++++++------- fs/nfs/nfs4_fs.h | 3 +-- fs/nfs/nfs4proc.c | 23 ++++++++++++----------- include/linux/nfs4.h | 1 + 4 files changed, 32 insertions(+), 20 deletions(-) -- 2.47.0