diff options
author | NeilBrown <neilb@suse.com> | 2018-04-30 06:31:30 +0200 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-05-31 20:59:19 +0200 |
commit | 3ca951b618386321d9396e9e26be7f4235b5cdb2 (patch) | |
tree | eec48e933fe7c8b956687aa689b7641d6a71b8e2 /fs/nfs/delegation.c | |
parent | NFS: slight optimization for walking list for delegations (diff) | |
download | linux-3ca951b618386321d9396e9e26be7f4235b5cdb2.tar.xz linux-3ca951b618386321d9396e9e26be7f4235b5cdb2.zip |
NFS: use cond_resched() when restarting walk of delegation list.
In three places we walk the list of delegations for an nfs_client
until an interesting one is found, then we act of that delegation
and restart the walk.
New delegations are added to the end of a list and the interesting
delegations are usually old, so in many case we won't repeat
a long walk over and over again, but it is possible - particularly if
the first server in the list has a large number of uninteresting
delegations.
In each cache the work done on interesting delegations will often
complete without sleeping, so this could loop many times without
giving up the CPU.
So add a cond_resched() at an appropriate point to avoid hogging the
CPU for too long.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs/delegation.c')
-rw-r--r-- | fs/nfs/delegation.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index b9cd3864335b..c454532b6f03 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -508,6 +508,7 @@ restart: err = nfs_end_delegation_return(inode, delegation, 0); iput(inode); nfs_sb_deactive(server->super); + cond_resched(); if (!err) goto restart; set_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state); @@ -904,6 +905,7 @@ restart: } iput(inode); nfs_sb_deactive(server->super); + cond_resched(); goto restart; } } @@ -1020,6 +1022,7 @@ restart: } iput(inode); nfs_sb_deactive(server->super); + cond_resched(); goto restart; } } |