Re: [PATCH] jbd2: make journal y2038 safe

From: Jan Kara
Date: Sun Jun 19 2016 - 11:57:20 EST


On Fri 17-06-16 17:39:00, Arnd Bergmann wrote:
> The jbd2 journal stores the commit time in 64-bit seconds and 32-bit
> nanoseconds, which avoids an overflow in 2038, but it gets the numbers
> from current_kernel_time(), which uses 'long' seconds on 32-bit
> architectures.
>
> This simply changes the code to call current_kernel_time64() so
> we use 64-bit seconds consistently.
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>

The patch looks good. You can add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

Honza

> ---
> fs/jbd2/commit.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
> index 8f7d1339c973..5bb565f9989c 100644
> --- a/fs/jbd2/commit.c
> +++ b/fs/jbd2/commit.c
> @@ -124,7 +124,7 @@ static int journal_submit_commit_record(journal_t *journal,
> struct commit_header *tmp;
> struct buffer_head *bh;
> int ret;
> - struct timespec now = current_kernel_time();
> + struct timespec64 now = current_kernel_time64();
>
> *cbh = NULL;
>
> --
> 2.9.0
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR