diff options
author | Jeff Layton <jlayton@primarydata.com> | 2014-05-30 09:09:26 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-05-30 20:25:28 -0400 |
commit | a832e7ae8b4f71fc522089d83fd445693aa7dbc5 (patch) | |
tree | 2d767b29b9e6bea6a187b044cf9dce49e6abfa42 /fs/nfsd | |
parent | da2ebce6a0f64cc01bd00aba998c0a4fa7c09843 (diff) |
nfsd: fix laundromat next-run-time calculation
The laundromat uses two variables to calculate when it should next run,
but one is completely ignored at the end of the run. Merge the two and
rename the variable to be more descriptive of what it does.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index d0a016a502be..01a0e4384500 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -3397,8 +3397,7 @@ nfs4_laundromat(struct nfsd_net *nn) | |||
3397 | struct nfs4_delegation *dp; | 3397 | struct nfs4_delegation *dp; |
3398 | struct list_head *pos, *next, reaplist; | 3398 | struct list_head *pos, *next, reaplist; |
3399 | time_t cutoff = get_seconds() - nn->nfsd4_lease; | 3399 | time_t cutoff = get_seconds() - nn->nfsd4_lease; |
3400 | time_t t, clientid_val = nn->nfsd4_lease; | 3400 | time_t t, new_timeo = nn->nfsd4_lease; |
3401 | time_t u, test_val = nn->nfsd4_lease; | ||
3402 | 3401 | ||
3403 | nfs4_lock_state(); | 3402 | nfs4_lock_state(); |
3404 | 3403 | ||
@@ -3410,8 +3409,7 @@ nfs4_laundromat(struct nfsd_net *nn) | |||
3410 | clp = list_entry(pos, struct nfs4_client, cl_lru); | 3409 | clp = list_entry(pos, struct nfs4_client, cl_lru); |
3411 | if (time_after((unsigned long)clp->cl_time, (unsigned long)cutoff)) { | 3410 | if (time_after((unsigned long)clp->cl_time, (unsigned long)cutoff)) { |
3412 | t = clp->cl_time - cutoff; | 3411 | t = clp->cl_time - cutoff; |
3413 | if (clientid_val > t) | 3412 | new_timeo = min(new_timeo, t); |
3414 | clientid_val = t; | ||
3415 | break; | 3413 | break; |
3416 | } | 3414 | } |
3417 | if (mark_client_expired_locked(clp)) { | 3415 | if (mark_client_expired_locked(clp)) { |
@@ -3434,9 +3432,8 @@ nfs4_laundromat(struct nfsd_net *nn) | |||
3434 | if (net_generic(dp->dl_stid.sc_client->net, nfsd_net_id) != nn) | 3432 | if (net_generic(dp->dl_stid.sc_client->net, nfsd_net_id) != nn) |
3435 | continue; | 3433 | continue; |
3436 | if (time_after((unsigned long)dp->dl_time, (unsigned long)cutoff)) { | 3434 | if (time_after((unsigned long)dp->dl_time, (unsigned long)cutoff)) { |
3437 | u = dp->dl_time - cutoff; | 3435 | t = dp->dl_time - cutoff; |
3438 | if (test_val > u) | 3436 | new_timeo = min(new_timeo, t); |
3439 | test_val = u; | ||
3440 | break; | 3437 | break; |
3441 | } | 3438 | } |
3442 | list_move(&dp->dl_recall_lru, &reaplist); | 3439 | list_move(&dp->dl_recall_lru, &reaplist); |
@@ -3446,21 +3443,18 @@ nfs4_laundromat(struct nfsd_net *nn) | |||
3446 | dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru); | 3443 | dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru); |
3447 | revoke_delegation(dp); | 3444 | revoke_delegation(dp); |
3448 | } | 3445 | } |
3449 | test_val = nn->nfsd4_lease; | ||
3450 | list_for_each_safe(pos, next, &nn->close_lru) { | 3446 | list_for_each_safe(pos, next, &nn->close_lru) { |
3451 | oo = container_of(pos, struct nfs4_openowner, oo_close_lru); | 3447 | oo = container_of(pos, struct nfs4_openowner, oo_close_lru); |
3452 | if (time_after((unsigned long)oo->oo_time, (unsigned long)cutoff)) { | 3448 | if (time_after((unsigned long)oo->oo_time, (unsigned long)cutoff)) { |
3453 | u = oo->oo_time - cutoff; | 3449 | t = oo->oo_time - cutoff; |
3454 | if (test_val > u) | 3450 | new_timeo = min(new_timeo, t); |
3455 | test_val = u; | ||
3456 | break; | 3451 | break; |
3457 | } | 3452 | } |
3458 | release_openowner(oo); | 3453 | release_openowner(oo); |
3459 | } | 3454 | } |
3460 | if (clientid_val < NFSD_LAUNDROMAT_MINTIMEOUT) | 3455 | new_timeo = max_t(time_t, new_timeo, NFSD_LAUNDROMAT_MINTIMEOUT); |
3461 | clientid_val = NFSD_LAUNDROMAT_MINTIMEOUT; | ||
3462 | nfs4_unlock_state(); | 3456 | nfs4_unlock_state(); |
3463 | return clientid_val; | 3457 | return new_timeo; |
3464 | } | 3458 | } |
3465 | 3459 | ||
3466 | static struct workqueue_struct *laundry_wq; | 3460 | static struct workqueue_struct *laundry_wq; |