From patchwork Fri Jan 22 14:32:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 8090721 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 87F669F859 for ; Fri, 22 Jan 2016 14:32:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AAAB7203A1 for ; Fri, 22 Jan 2016 14:32:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 89E2920395 for ; Fri, 22 Jan 2016 14:32:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754287AbcAVOcg (ORCPT ); Fri, 22 Jan 2016 09:32:36 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:61522 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754267AbcAVOcc (ORCPT ); Fri, 22 Jan 2016 09:32:32 -0500 Received: from wuerfel.localnet ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue003) with ESMTPSA (Nemesis) id 0MaFzQ-1agTzW29kG-00JoNw; Fri, 22 Jan 2016 15:32:02 +0100 From: Arnd Bergmann To: David Howells , linux-afs@lists.infradead.org Cc: Al Viro , linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND] AFS: Correctly use 64-bit time for UUID Date: Fri, 22 Jan 2016 15:32:01 +0100 Message-ID: <16523194.QYgGaJTPRn@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V03:K0:BgXd03Yeregt61GKn7lkA9p6wjOvccDboHuY1Ezjqfu5E+Lz4bi skg1jZTJwIc3fLy5tSJFgNIg49YUVh96yxHECsEC63+ScReJ1y7S4nVqFIomkKmAJs5+v6K f4AGBr4E8PsdvI9JmuVEwfB7yFsf20UK3CrcW/z/u9bYsWo9HzYGhi+AkdlLzlNtqJXfl3f vy1iV9tAZMKg48zcjv9NA== X-UI-Out-Filterresults: notjunk:1; V01:K0:UPGl2u1TfjE=:hqjtUf+QcCac9spB6tSIVn dzLVT555j1c8LxOslbR4H9VYOwU2bpaJznPpknyVdMC5gGtT8fb1UNSGOzOXUMtpZGNhks+CW tG481pcr2JZIFaq6M83YOvVpaNkVcPymU7bWlQpHCcjs15DFHaibqqlU1h+SvxE+AT399V8Fu fUVTk0pXB8sDog1w3srnjMqUMhss/nzh0J8BjnmYO0uG4HCdju5DDsM8fHQimQZVIAmkQ37sl CPj1LiOo2KcQ8GDNn5WG3qF6QZ3bdh5HzC4fPqNP66JR/tsYBsZXmVE2M712dNY3IOajZLCwo c5K8rDkDzlaTaHOAA0klSX8aOWtLXL0yAi/c+j9hLgOpSCIlxyENyfgyYlSWNN9kREWz3C42/ 9Ki4wcQXzZXtZjbUlQNrz+EijO5ohk823E2XVRuLkgyHm9zApiniY8wJ2DRgbFWAB7SskO4mJ WY6kM8GsqAlsihh5Bm31Sl/rrFu2Ta9Iy/Z4tCjBeqhTTE2M4XqZvNeujL/igccrMPm3LD/fz l29laLM2QDgZm19va3rgpUm42X/xSBP3vbSG7cMNR453UyEl9Xu8f47Sc4VVVuy4qpXFHklkv jX60dj7eyhbAW47AnrEP4TueK9ywpdvUCzUrpfRsN14gmHwbU9NtsIxFrVvlihmEy6+VaWMqP KaWJy2DfGDMtN3axekcCrS3S6WDWNcqDMt6fVzo/+h5MqW9LShJGmAWWMP21WmHAmpXwxG2P0 nDYmUr+tLZIWvEDo Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP UUID calculation uses 'struct timespec' whose seconds will overflow in year 2038 and beyond for 32-bit systems. This patch removes the dependency on 'struct timespec' by using ktime_get_real(). While the patch does not fix a 'bug' as such, it is part of a larger effort to remove instances of 'struct timespec' and other data-structures suffering from y2038 problem from the kernel. Suggested-by: Arnd Bergmann Signed-off-by: Tina Ruchandani Signed-off-by: Arnd Bergmann --- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/afs/main.c b/fs/afs/main.c index 35de0c04729f..129ff432391c 100644 --- a/fs/afs/main.c +++ b/fs/afs/main.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "internal.h" MODULE_DESCRIPTION("AFS Client File System"); @@ -37,7 +38,6 @@ struct workqueue_struct *afs_wq; */ static int __init afs_get_client_UUID(void) { - struct timespec ts; u64 uuidtime; u16 clockseq; int ret; @@ -48,9 +48,7 @@ static int __init afs_get_client_UUID(void) if (ret < 0) return ret; - getnstimeofday(&ts); - uuidtime = (u64) ts.tv_sec * 1000 * 1000 * 10; - uuidtime += ts.tv_nsec / 100; + uuidtime = ktime_divns(ktime_get_real(), 100); uuidtime += AFS_UUID_TO_UNIX_TIME; afs_uuid.time_low = uuidtime; afs_uuid.time_mid = uuidtime >> 32;