]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nfsd: fix delay timer on 32-bit architectures
authorArnd Bergmann <arnd@arndb.de>
Sun, 3 Nov 2019 21:32:20 +0000 (22:32 +0100)
committerJ. Bruce Fields <bfields@redhat.com>
Thu, 19 Dec 2019 22:46:08 +0000 (17:46 -0500)
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: 3bdf46658793 ("nfsd: give up on CB_LAYOUTRECALLs after two lease periods")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4layouts.c

index 2681c70283ce24b25166f6edd9d033197001b453..e12409eca7cc42facf54b4af0d8a636e6bc7fb0e 100644 (file)
@@ -675,7 +675,7 @@ nfsd4_cb_layout_done(struct nfsd4_callback *cb, struct rpc_task *task)
 
                /* Client gets 2 lease periods to return it */
                cutoff = ktime_add_ns(task->tk_start,
-                                        nn->nfsd4_lease * NSEC_PER_SEC * 2);
+                                        (u64)nn->nfsd4_lease * NSEC_PER_SEC * 2);
 
                if (ktime_before(now, cutoff)) {
                        rpc_delay(task, HZ/100); /* 10 mili-seconds */