diff options
author | Arnd Bergmann <arnd@arndb.de> | 2018-08-22 01:01:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-22 13:52:51 -0400 |
commit | 3e811f053aec66e8a6d2a0ee3d031e7c988e3d15 (patch) | |
tree | 222e4403c041f7a4c70360471ca9d4cf4a3e13ff /fs/sysv/inode.c | |
parent | d9edcbc42c77b719e03dedb2aff719ae19659a0f (diff) |
fs/sysv/inode.c: use ktime_get_real_seconds() for superblock stamp
get_seconds() is deprecated in favor of ktime_get_real_seconds(), which
returns a 64-bit timestamp.
In the SYSV file system, the superblock timestamp is only 32 bits wide,
and it is used to check whether a file system is clean, so the best
solution seems to be to force a wraparound and explicitly convert it to an
unsigned 32-bit value.
This is independent of the inode timestamps that are also 32-bit wide on
disk and that come from current_time().
Link: http://lkml.kernel.org/r/20180713145236.3152513-1-arnd@arndb.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/sysv/inode.c')
-rw-r--r-- | fs/sysv/inode.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c index bec9f79adb25..499a20a5a010 100644 --- a/fs/sysv/inode.c +++ b/fs/sysv/inode.c | |||
@@ -35,7 +35,7 @@ | |||
35 | static int sysv_sync_fs(struct super_block *sb, int wait) | 35 | static int sysv_sync_fs(struct super_block *sb, int wait) |
36 | { | 36 | { |
37 | struct sysv_sb_info *sbi = SYSV_SB(sb); | 37 | struct sysv_sb_info *sbi = SYSV_SB(sb); |
38 | unsigned long time = get_seconds(), old_time; | 38 | u32 time = (u32)ktime_get_real_seconds(), old_time; |
39 | 39 | ||
40 | mutex_lock(&sbi->s_lock); | 40 | mutex_lock(&sbi->s_lock); |
41 | 41 | ||
@@ -46,8 +46,8 @@ static int sysv_sync_fs(struct super_block *sb, int wait) | |||
46 | */ | 46 | */ |
47 | old_time = fs32_to_cpu(sbi, *sbi->s_sb_time); | 47 | old_time = fs32_to_cpu(sbi, *sbi->s_sb_time); |
48 | if (sbi->s_type == FSTYPE_SYSV4) { | 48 | if (sbi->s_type == FSTYPE_SYSV4) { |
49 | if (*sbi->s_sb_state == cpu_to_fs32(sbi, 0x7c269d38 - old_time)) | 49 | if (*sbi->s_sb_state == cpu_to_fs32(sbi, 0x7c269d38u - old_time)) |
50 | *sbi->s_sb_state = cpu_to_fs32(sbi, 0x7c269d38 - time); | 50 | *sbi->s_sb_state = cpu_to_fs32(sbi, 0x7c269d38u - time); |
51 | *sbi->s_sb_time = cpu_to_fs32(sbi, time); | 51 | *sbi->s_sb_time = cpu_to_fs32(sbi, time); |
52 | mark_buffer_dirty(sbi->s_bh2); | 52 | mark_buffer_dirty(sbi->s_bh2); |
53 | } | 53 | } |