NFSv4: Fix a regression in the handling of CB_RECALL_ANY

When the flag NFS_DELEGATION_RETURN was replaced by the
server->delegations_return list, the test in
nfs_mark_return_if_closed_delegation() was replaced by one that stops
all further marking of delegations for return when closed as soon as the
server->delegations_return list is non-empty, breaking CB_RECALL_ANY
behaviour.

While the intention at the time was probably to check if
delegation->entry was non-empty in order to emulate the effect of the
NFS_DELEGATION_RETURN test, that is no longer an option, since
delegation->entry is also used for the LRU list.

By just removing the offending check altogether, the patch can end up
moving delegations from the server->delegations_delayed list
prematurely, triggering an early retry. However that should be mostly
harmless behaviour.

Fixes: 0ebe655bd0 ("NFS: add a separate delegation return list")
Cc: stable@vger.kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
Trond Myklebust 2026-09-11 11:00:02 -04:00
parent 93f51579e7
commit 25dde93598

View File

@ -934,8 +934,7 @@ nfs_mark_return_if_closed_delegation(struct nfs_server *server,
{
struct inode *inode;
if (!list_empty_careful(&server->delegations_return) ||
test_bit(NFS_DELEGATION_RETURN_IF_CLOSED, &delegation->flags))
if (test_bit(NFS_DELEGATION_RETURN_IF_CLOSED, &delegation->flags))
return;
spin_lock(&delegation->lock);
inode = delegation->inode;