* [PATCH] s390: hypfs: use ktime_get_seconds() instead of get_seconds()
@ 2018-06-18 10:05 Arnd Bergmann
2018-06-18 11:26 ` Martin Schwidefsky
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2018-06-18 10:05 UTC (permalink / raw)
To: Martin Schwidefsky, Heiko Carstens
Cc: y2038, Arnd Bergmann, linux-s390, linux-kernel
time_t and get_seconds() are deprecated because they will overflow on
32-bit architectures in the future. This is not a problem on 64-bit s390,
but we should use proper interfaces anyway.
Besides moving to the time64_t based interface, the CLOCK_MONOTONIC
based ktime_get_seconds() is preferred for kernel internal timekeeping
because it does not behave in unexpected ways during leap second changes
or settimeofday() calls.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/s390/hypfs/inode.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 06b513d192b9..c681329fdeec 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -36,7 +36,7 @@ struct hypfs_sb_info {
kuid_t uid; /* uid used for files and dirs */
kgid_t gid; /* gid used for files and dirs */
struct dentry *update_file; /* file to trigger update */
- time_t last_update; /* last update time in secs since 1970 */
+ time64_t last_update; /* last update, CLOCK_MONOTONIC time */
struct mutex lock; /* lock to protect update process */
};
@@ -52,7 +52,7 @@ static void hypfs_update_update(struct super_block *sb)
struct hypfs_sb_info *sb_info = sb->s_fs_info;
struct inode *inode = d_inode(sb_info->update_file);
- sb_info->last_update = get_seconds();
+ sb_info->last_update = ktime_get_seconds();
inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
}
@@ -179,7 +179,7 @@ static ssize_t hypfs_write_iter(struct kiocb *iocb, struct iov_iter *from)
* to restart data collection in this case.
*/
mutex_lock(&fs_info->lock);
- if (fs_info->last_update == get_seconds()) {
+ if (fs_info->last_update == ktime_get_seconds()) {
rc = -EBUSY;
goto out;
}
--
2.9.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] s390: hypfs: use ktime_get_seconds() instead of get_seconds()
2018-06-18 10:05 [PATCH] s390: hypfs: use ktime_get_seconds() instead of get_seconds() Arnd Bergmann
@ 2018-06-18 11:26 ` Martin Schwidefsky
0 siblings, 0 replies; 2+ messages in thread
From: Martin Schwidefsky @ 2018-06-18 11:26 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Heiko Carstens, y2038, linux-s390, linux-kernel
On Mon, 18 Jun 2018 12:05:00 +0200
Arnd Bergmann <arnd@arndb.de> wrote:
> time_t and get_seconds() are deprecated because they will overflow on
> 32-bit architectures in the future. This is not a problem on 64-bit s390,
> but we should use proper interfaces anyway.
>
> Besides moving to the time64_t based interface, the CLOCK_MONOTONIC
> based ktime_get_seconds() is preferred for kernel internal timekeeping
> because it does not behave in unexpected ways during leap second changes
> or settimeofday() calls.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Added to my set of patches for the next merge window.
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-18 11:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18 10:05 [PATCH] s390: hypfs: use ktime_get_seconds() instead of get_seconds() Arnd Bergmann
2018-06-18 11:26 ` Martin Schwidefsky
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.