From patchwork Sat Jun 25 21:37:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9198791 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EE2516075F for ; Sat, 25 Jun 2016 21:43:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E608C28529 for ; Sat, 25 Jun 2016 21:43:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB1D82852E; Sat, 25 Jun 2016 21:43:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7529728529 for ; Sat, 25 Jun 2016 21:43:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751909AbcFYVif (ORCPT ); Sat, 25 Jun 2016 17:38:35 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:33673 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751863AbcFYVid (ORCPT ); Sat, 25 Jun 2016 17:38:33 -0400 Received: by mail-pa0-f67.google.com with SMTP id ts6so11972371pac.0; Sat, 25 Jun 2016 14:38:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mltWG5CVaXT8LiVW/DYVFBzvH4r3FBiKWu497TAU5gQ=; b=KAJbvpJzFW9HniSIEzohOhiqEa7pvqtxIr6ede763+rn3fLRx1e7wbNMWTxXmdj3mc fdksvHWuYwwOYBOr/uKiISVYae5Fgjt/NByijgu20DGIQbRkx4X9t4UCC2LiFVhWriTN ImjJvKmgUORV7T3me79Z8pJG7lRt8pNkAAoca2yggXqVQAlBC25EDcpsTgLXwb2VbLZu QfIHHfl49vF0oqY2WGIEQULlb8WO17qIEMMcenMVvPy7nyA3OXWhtpfED8zsUy6VvC8T uAHsAJZUaPoxhwqogShX+BdgGyAyV+85rJsoQkOLUe02dDRwcjRhWnBjJ21nnqlkhtnR FQ1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mltWG5CVaXT8LiVW/DYVFBzvH4r3FBiKWu497TAU5gQ=; b=iT1t4G7FbJWh+k1/clDXhQ+OZf5zn8mSq5pv2kMiZ+WQA9S5iyOpjA0jA0V5hq9mKY XF/sVXI1WATvT4jDMz8qlFHQ1WNgkMIcUkFc0SoAHTK7Ki9vNXMvV6ciOoMC51I81G/l ds1npEeXIw+MIuFHC9791f8aKK8UapiqZfY1tNZX00zqJ16duTYdQAaS+/vzma55Q1Cf hY2knaYS8pLlTY9W4AnRAqTHvRtAkVbEDlQ4ULFEPGJ8dIfLxWRtQTJsloI5MXRTv9VY cJCpBHVza+ufGJPhLdzUhRWgdCyXz22WIqSYhABGcY2uYe204TOqxDOuVd+scV5kK8ZQ 3Teg== X-Gm-Message-State: ALyK8tIU1jOkonfaS2nmMOB3kfZ+WFRx6YKBnU8DVYD76GEWNuK4IC4Glo9E/QP8Q7nCBA== X-Received: by 10.66.104.34 with SMTP id gb2mr20135879pab.12.1466890713059; Sat, 25 Jun 2016 14:38:33 -0700 (PDT) Received: from deepa-ubuntu.hsd1.ca.comcast.net (c-73-252-251-201.hsd1.ca.comcast.net. [73.252.251.201]) by smtp.gmail.com with ESMTPSA id m8sm1861308pfi.27.2016.06.25.14.38.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 25 Jun 2016 14:38:32 -0700 (PDT) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, tglx@linutronix.de, torvalds@linux-foundation.org, tytso@mit.edu, viro@zeniv.linux.org.uk, y2038@lists.linaro.org, Jan Kara Subject: [PATCH v3 10/24] fs: udf: Replace CURRENT_TIME with current_time() Date: Sat, 25 Jun 2016 14:37:34 -0700 Message-Id: <1466890668-23400-11-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466890668-23400-1-git-send-email-deepa.kernel@gmail.com> References: <1466890668-23400-1-git-send-email-deepa.kernel@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP CURRENT_TIME is not y2038 safe. CURRENT_TIME macro is also not appropriate for filesystems as it doesn't use the right granularity for filesystem timestamps. Logical Volume Integrity format is described to have the same timestamp format for "Recording Date and time" as the other [a,c,m]timestamps. The function udf_time_to_disk_format() does this conversion. Hence the timestamp is passed directly to the function and not truncated. This is as per Arnd's suggestion on the thread. This is also in preparation for the patch that transitions vfs timestamps to use 64 bit time and hence make them y2038 safe. As part of the effort current_time() will be extended to do range checks. Signed-off-by: Deepa Dinamani Cc: Jan Kara Reviewed-by: Jan Kara --- fs/udf/super.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/udf/super.c b/fs/udf/super.c index 4942549..967ad87 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1986,6 +1986,7 @@ static void udf_open_lvid(struct super_block *sb) struct buffer_head *bh = sbi->s_lvid_bh; struct logicalVolIntegrityDesc *lvid; struct logicalVolIntegrityDescImpUse *lvidiu; + struct timespec ts; if (!bh) return; @@ -1997,8 +1998,8 @@ static void udf_open_lvid(struct super_block *sb) mutex_lock(&sbi->s_alloc_mutex); lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; - udf_time_to_disk_stamp(&lvid->recordingDateAndTime, - CURRENT_TIME); + ktime_get_real_ts(&ts); + udf_time_to_disk_stamp(&lvid->recordingDateAndTime, ts); lvid->integrityType = cpu_to_le32(LVID_INTEGRITY_TYPE_OPEN); lvid->descTag.descCRC = cpu_to_le16( @@ -2019,6 +2020,7 @@ static void udf_close_lvid(struct super_block *sb) struct buffer_head *bh = sbi->s_lvid_bh; struct logicalVolIntegrityDesc *lvid; struct logicalVolIntegrityDescImpUse *lvidiu; + struct timespec ts; if (!bh) return; @@ -2030,7 +2032,8 @@ static void udf_close_lvid(struct super_block *sb) mutex_lock(&sbi->s_alloc_mutex); lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; - udf_time_to_disk_stamp(&lvid->recordingDateAndTime, CURRENT_TIME); + ktime_get_real_ts(&ts); + udf_time_to_disk_stamp(&lvid->recordingDateAndTime, ts); if (UDF_MAX_WRITE_VERSION > le16_to_cpu(lvidiu->maxUDFWriteRev)) lvidiu->maxUDFWriteRev = cpu_to_le16(UDF_MAX_WRITE_VERSION); if (sbi->s_udfrev > le16_to_cpu(lvidiu->minUDFReadRev))