diff options
author | Tim Chase <[email protected]> | 2015-01-11 10:37:43 -0600 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-01-16 13:54:35 -0800 |
commit | 47af4b76ffe72457166e4abfcfe23848ac51811a (patch) | |
tree | c8ca9b0d8bf26ec6bb032e143a980dc354de3049 /include/sys/time.h | |
parent | 03a783534ad9ea1db71d978f9f850f9dd13ccd51 (diff) |
Use current_kernel_time() in the time compatibility wrappers
Since the Linux kernel's utimens family of functions uses
current_kernel_time(), we need to do the same in the context of ZFS
or else there can be discrepencies in timestamps (they go backward)
if userland code does:
fd = creat(FNAME, 0600);
(void) futimens(fd, NULL);
The getnstimeofday() function generally returns a slightly lower time
value.
Signed-off-by: Tim Chase <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes zfsonlinux/zfs#3006
Diffstat (limited to 'include/sys/time.h')
-rw-r--r-- | include/sys/time.h | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/include/sys/time.h b/include/sys/time.h index b9826d2b7..76ce5f03c 100644 --- a/include/sys/time.h +++ b/include/sys/time.h @@ -54,17 +54,14 @@ static inline void gethrestime(timestruc_t *now) { - struct timespec ts; - getnstimeofday(&ts); - now->tv_sec = ts.tv_sec; - now->tv_nsec = ts.tv_nsec; + *now = current_kernel_time(); } static inline time_t gethrestime_sec(void) { struct timespec ts; - getnstimeofday(&ts); + ts = current_kernel_time(); return (ts.tv_sec); } |