Commit d5ffce3b authored by Christoph Hellwig's avatar Christoph Hellwig

XFS: XFS: Use do_gettimeofday() instead of racy direct access to xtime

Modid: 2.5.x-xfs:slinx:127568a
parent 0cd9efe3
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#define __XFS_SUPPORT_TIME_H__ #define __XFS_SUPPORT_TIME_H__
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/time.h>
static inline void delay(long ticks) static inline void delay(long ticks)
{ {
...@@ -42,8 +43,11 @@ static inline void delay(long ticks) ...@@ -42,8 +43,11 @@ static inline void delay(long ticks)
static inline void nanotime(struct timespec *tvp) static inline void nanotime(struct timespec *tvp)
{ {
tvp->tv_sec = xtime.tv_sec; struct timeval tv;
tvp->tv_nsec = xtime.tv_nsec;
do_gettimeofday(&tv);
tvp->tv_sec = tv.tv_sec;
tvp->tv_nsec = tv.tv_usec * 1000;
} }
#endif /* __XFS_SUPPORT_TIME_H__ */ #endif /* __XFS_SUPPORT_TIME_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment