nfsd: use ktime_get_seconds() for timestamps
[ Upstream commit b3f255ef6bffc18a28c3b6295357f2a3380c033f ]
The delegation logic in nfsd uses the somewhat inefficient
seconds_since_boot() function to record time intervals.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Stable-dep-of: 45bb63ed20e0 ("nfsd: fix delegation_blocked() to block correctly for at least 30 seconds")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
fe5e9182d3
commit
8843824b67
1 changed files with 5 additions and 5 deletions
|
|
@ -832,7 +832,7 @@ static void nfs4_free_deleg(struct nfs4_stid *stid)
|
|||
static DEFINE_SPINLOCK(blocked_delegations_lock);
|
||||
static struct bloom_pair {
|
||||
int entries, old_entries;
|
||||
time_t swap_time;
|
||||
time64_t swap_time;
|
||||
int new; /* index into 'set' */
|
||||
DECLARE_BITMAP(set[2], 256);
|
||||
} blocked_delegations;
|
||||
|
|
@ -844,15 +844,15 @@ static int delegation_blocked(struct knfsd_fh *fh)
|
|||
|
||||
if (bd->entries == 0)
|
||||
return 0;
|
||||
if (seconds_since_boot() - bd->swap_time > 30) {
|
||||
if (ktime_get_seconds() - bd->swap_time > 30) {
|
||||
spin_lock(&blocked_delegations_lock);
|
||||
if (seconds_since_boot() - bd->swap_time > 30) {
|
||||
if (ktime_get_seconds() - bd->swap_time > 30) {
|
||||
bd->entries -= bd->old_entries;
|
||||
bd->old_entries = bd->entries;
|
||||
memset(bd->set[bd->new], 0,
|
||||
sizeof(bd->set[0]));
|
||||
bd->new = 1-bd->new;
|
||||
bd->swap_time = seconds_since_boot();
|
||||
bd->swap_time = ktime_get_seconds();
|
||||
}
|
||||
spin_unlock(&blocked_delegations_lock);
|
||||
}
|
||||
|
|
@ -882,7 +882,7 @@ static void block_delegations(struct knfsd_fh *fh)
|
|||
__set_bit((hash>>8)&255, bd->set[bd->new]);
|
||||
__set_bit((hash>>16)&255, bd->set[bd->new]);
|
||||
if (bd->entries == 0)
|
||||
bd->swap_time = seconds_since_boot();
|
||||
bd->swap_time = ktime_get_seconds();
|
||||
bd->entries += 1;
|
||||
spin_unlock(&blocked_delegations_lock);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue