Skip to content

Commit

Permalink
nfsd: fix laundromat next-run-time calculation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff Layton authored and J. Bruce Fields committed May 31, 2014
1 parent da2ebce commit a832e7a
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -3397,8 +3397,7 @@ nfs4_laundromat(struct nfsd_net *nn)
struct nfs4_delegation *dp;
struct list_head *pos, *next, reaplist;
time_t cutoff = get_seconds() - nn->nfsd4_lease;
time_t t, clientid_val = nn->nfsd4_lease;
time_t u, test_val = nn->nfsd4_lease;
time_t t, new_timeo = nn->nfsd4_lease;

nfs4_lock_state();

Expand All @@ -3410,8 +3409,7 @@ nfs4_laundromat(struct nfsd_net *nn)
clp = list_entry(pos, struct nfs4_client, cl_lru);
if (time_after((unsigned long)clp->cl_time, (unsigned long)cutoff)) {
t = clp->cl_time - cutoff;
if (clientid_val > t)
clientid_val = t;
new_timeo = min(new_timeo, t);
break;
}
if (mark_client_expired_locked(clp)) {
Expand All @@ -3434,9 +3432,8 @@ nfs4_laundromat(struct nfsd_net *nn)
if (net_generic(dp->dl_stid.sc_client->net, nfsd_net_id) != nn)
continue;
if (time_after((unsigned long)dp->dl_time, (unsigned long)cutoff)) {
u = dp->dl_time - cutoff;
if (test_val > u)
test_val = u;
t = dp->dl_time - cutoff;
new_timeo = min(new_timeo, t);
break;
}
list_move(&dp->dl_recall_lru, &reaplist);
Expand All @@ -3446,21 +3443,18 @@ nfs4_laundromat(struct nfsd_net *nn)
dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
revoke_delegation(dp);
}
test_val = nn->nfsd4_lease;
list_for_each_safe(pos, next, &nn->close_lru) {
oo = container_of(pos, struct nfs4_openowner, oo_close_lru);
if (time_after((unsigned long)oo->oo_time, (unsigned long)cutoff)) {
u = oo->oo_time - cutoff;
if (test_val > u)
test_val = u;
t = oo->oo_time - cutoff;
new_timeo = min(new_timeo, t);
break;
}
release_openowner(oo);
}
if (clientid_val < NFSD_LAUNDROMAT_MINTIMEOUT)
clientid_val = NFSD_LAUNDROMAT_MINTIMEOUT;
new_timeo = max_t(time_t, new_timeo, NFSD_LAUNDROMAT_MINTIMEOUT);
nfs4_unlock_state();
return clientid_val;
return new_timeo;
}

static struct workqueue_struct *laundry_wq;
Expand Down

0 comments on commit a832e7a

Please sign in to comment.