From patchwork Sat Aug 13 22:48:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9278755 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 AD05A60839 for ; Sun, 14 Aug 2016 10:43:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E56728A0B for ; Sun, 14 Aug 2016 10:43:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9343428A1E; Sun, 14 Aug 2016 10:43:43 +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 4247528A0B for ; Sun, 14 Aug 2016 10:43:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753081AbcHNKn2 (ORCPT ); Sun, 14 Aug 2016 06:43:28 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:33336 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751243AbcHNKn1 (ORCPT ); Sun, 14 Aug 2016 06:43:27 -0400 Received: by mail-pa0-f66.google.com with SMTP id vy10so2028296pac.0; Sun, 14 Aug 2016 03:43:27 -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=L5Ud1SHI6tMwjtjdWKSfmxyv9z2piHFUnJLVHHz4P2w=; b=T9HH+Bk9LMRJbQ3aMw1n81Xw2j0ObudhmT7cD+ANmcJ1e64KMNAG68yXlNtGRmyTqP ubxpTqUEgr7MJ9L71mYzFNDTr43+WlhmxTSa4K+laizUHBIKzEbEdRAF2FrKMOWy4PEd 4hNmvFM+AVQFa8j8rdhw7pj5aTcr5zHPQTG95yPxsX0+lV3uqqobyo2pk+7a6WWlHFaR GKHDA9InUueObgz23P1uNBSlWuq9luhXeFCbGayTfq1jMil8P1VoMqiAh2drGi67yB7f S6SrYIe6gXrdQ6IPZLeu5y186QMsEbbI4wuS4+GT5c3i2MYSBEmzCJfnhLeYYT+WM2VI Cmzg== 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=L5Ud1SHI6tMwjtjdWKSfmxyv9z2piHFUnJLVHHz4P2w=; b=gNJbIa+TgW/pvz2PQ0KZbqQMDmCqEi4mAO7vT8hOgn0QEBul9Ku8c9EuwxMbIKLctz aWrTfII73coN5/YGberjtCihSqeMA7JnUBt0BirVIZP6CouOONEz73myUXFlt0RzSqrV nqhDgOxY/sz/r0kKJbwSzWolWLBnqIMYwB9aIQK4v0TrDsmeMfU4ISsdUscss1wvFE5B /rTX97fMlQXtsWb0wnQV1D6wCdDKNNEADcLQkzuDWUhYiEMNqU6uW+n8V70hVVALC7v2 RJy9mluLJsl4H/6eUEknb8KsHPeYOtOL0rd/axolWigkptINCHImr4sAJzOcFllv2ied dJGw== X-Gm-Message-State: AEkoout1mK2l4FEZzUiPEbtis4gxCORQqqcwrDvjiTbA7K2sbkgDWADoXsVfbbRTc4tltw== X-Received: by 10.66.235.100 with SMTP id ul4mr39942367pac.50.1471128569218; Sat, 13 Aug 2016 15:49:29 -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 81sm22528007pfm.90.2016.08.13.15.49.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Aug 2016 15:49:28 -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 v4 11/26] fs: udf: Replace CURRENT_TIME with current_time() Date: Sat, 13 Aug 2016 15:48:23 -0700 Message-Id: <1471128518-24075-12-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471128518-24075-1-git-send-email-deepa.kernel@gmail.com> References: <1471128518-24075-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 Reviewed-by: Arnd Bergmann --- 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))