Feedback welcomed.
Signed-off-by: Loganaden Velvindron logan@hackers.mu --- fs/fuse/dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index c47b778..75e5e4f 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -76,8 +76,8 @@ static u64 fuse_dentry_time(struct dentry *entry) static u64 time_to_jiffies(unsigned long sec, unsigned long nsec) { if (sec || nsec) { - struct timespec ts = {sec, nsec}; - return get_jiffies_64() + timespec_to_jiffies(&ts); + struct timespec64 ts64 = {sec, nsec}; + return get_jiffies_64() + timespec64_to_jiffies(&ts64); } else return 0; }
On Thu, 11 Aug 2016, Loganaden Velvindron wrote:
Feedback welcomed.
This part of a patch becomes the commit message, and should explain what is done.
julia
Signed-off-by: Loganaden Velvindron logan@hackers.mu
fs/fuse/dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index c47b778..75e5e4f 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -76,8 +76,8 @@ static u64 fuse_dentry_time(struct dentry *entry) static u64 time_to_jiffies(unsigned long sec, unsigned long nsec) { if (sec || nsec) {
struct timespec ts = {sec, nsec};
return get_jiffies_64() + timespec_to_jiffies(&ts);
struct timespec64 ts64 = {sec, nsec};
} else return 0;return get_jiffies_64() + timespec64_to_jiffies(&ts64);
}
2.9.2
Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
On Thursday, August 11, 2016 4:49:22 PM CEST Loganaden Velvindron wrote:
index c47b778..75e5e4f 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -76,8 +76,8 @@ static u64 fuse_dentry_time(struct dentry *entry) static u64 time_to_jiffies(unsigned long sec, unsigned long nsec) { if (sec || nsec) {
struct timespec ts = {sec, nsec};
return get_jiffies_64() + timespec_to_jiffies(&ts);
struct timespec64 ts64 = {sec, nsec};
return get_jiffies_64() + timespec64_to_jiffies(&ts64);
The conversion looks correct, but aside from Julia's comment about the patch description, I'd also change the subject line: it sounds like this is the only problem in fuse, but it only addresses one aspect but leaves the actual inode time stamps untouched.
Note that timespec64_to_jiffies returns an 'unsigned long', which will also overflow on 32-bit architectures after 2^32 jiffies (a couple of months depending on CONFIG_HZ). To be on the safe side, we could instead open-code a simpler timespec64_to_jiffies() here and use
return get_jiffies_64() + sec * HZ + ((u32)nsec + TICK_NSEC - 1) / TICK_NSEC;
Arnd