Skip to content

Commit 1df92bf

Browse files
arndbgregkh
authored andcommitted
nfsd: fix delay timer on 32-bit architectures
commit 2561c92 upstream. The nfsd4_cb_layout_done() function takes a 'time_t' value, multiplied by NSEC_PER_SEC*2 to get a nanosecond value. This works fine on 64-bit architectures, but on 32-bit, any value over 1 second results in a signed integer overflow with unexpected results. Cast one input to a 64-bit type in order to produce the same result that we have on 64-bit architectures, regarless of the type of nfsd4_lease. Fixes: 6b9b210 ("nfsd: give up on CB_LAYOUTRECALLs after two lease periods") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ad0716a commit 1df92bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/nfsd/nfs4layouts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ nfsd4_cb_layout_done(struct nfsd4_callback *cb, struct rpc_task *task)
680680

681681
/* Client gets 2 lease periods to return it */
682682
cutoff = ktime_add_ns(task->tk_start,
683-
nn->nfsd4_lease * NSEC_PER_SEC * 2);
683+
(u64)nn->nfsd4_lease * NSEC_PER_SEC * 2);
684684

685685
if (ktime_before(now, cutoff)) {
686686
rpc_delay(task, HZ/100); /* 10 mili-seconds */

0 commit comments

Comments
 (0)