Skip to content

Commit 35a566a

Browse files
author
Trond Myklebust
committed
NFSv4: Avoid unnecessary scans of filesystems for returning delegations
The amount of looping through the list of delegations is occasionally leading to soft lockups. If the state manager was asked to return delegations asynchronously, it should only scan those filesystems that hold delegations that need to be returned. Fixes: af3b61b ("NFSv4: Clean up nfs_client_return_marked_delegations()") Signed-off-by: Trond Myklebust <[email protected]>
1 parent 47acca8 commit 35a566a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

fs/nfs/delegation.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ static void nfs_mark_return_delegation(struct nfs_server *server,
7979
struct nfs_delegation *delegation)
8080
{
8181
set_bit(NFS_DELEGATION_RETURN, &delegation->flags);
82+
set_bit(NFS4SERV_DELEGRETURN, &server->delegation_flags);
8283
set_bit(NFS4CLNT_DELEGRETURN, &server->nfs_client->cl_state);
8384
}
8485

@@ -608,6 +609,9 @@ static int nfs_server_return_marked_delegations(struct nfs_server *server,
608609
struct nfs_delegation *place_holder_deleg = NULL;
609610
int err = 0;
610611

612+
if (!test_and_clear_bit(NFS4SERV_DELEGRETURN,
613+
&server->delegation_flags))
614+
return 0;
611615
restart:
612616
/*
613617
* To avoid quadratic looping we hold a reference
@@ -659,6 +663,7 @@ static int nfs_server_return_marked_delegations(struct nfs_server *server,
659663
cond_resched();
660664
if (!err)
661665
goto restart;
666+
set_bit(NFS4SERV_DELEGRETURN, &server->delegation_flags);
662667
set_bit(NFS4CLNT_DELEGRETURN, &server->nfs_client->cl_state);
663668
goto out;
664669
}

include/linux/nfs_fs_sb.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ struct nfs_server {
250250
struct list_head ss_copies;
251251
struct list_head ss_src_copies;
252252

253+
unsigned long delegation_flags;
254+
#define NFS4SERV_DELEGRETURN (1)
253255
unsigned long delegation_gen;
254256
unsigned long mig_gen;
255257
unsigned long mig_status;

0 commit comments

Comments
 (0)