summaryrefslogtreecommitdiffstats
path: root/fs/udf/super.c
diff options
context:
space:
mode:
authorDeepa Dinamani <deepa.kernel@gmail.com>2017-01-02 22:20:55 -0500
committerJan Kara <jack@suse.cz>2017-01-03 04:51:26 -0500
commit88b50ce3ab5af60c85905784c938a35c967addf4 (patch)
treeb8b09a5750427249cf2bfa095eafb7045f8347fa /fs/udf/super.c
parent0c744ea4f77d72b3dcebb7a8f2684633ec79be88 (diff)
fs: udf: Replace CURRENT_TIME with current_time()
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 <deepa.kernel@gmail.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/super.c')
-rw-r--r--fs/udf/super.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 4942549e7dc8..967ad8775af2 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1986,6 +1986,7 @@ static void udf_open_lvid(struct super_block *sb)
1986 struct buffer_head *bh = sbi->s_lvid_bh; 1986 struct buffer_head *bh = sbi->s_lvid_bh;
1987 struct logicalVolIntegrityDesc *lvid; 1987 struct logicalVolIntegrityDesc *lvid;
1988 struct logicalVolIntegrityDescImpUse *lvidiu; 1988 struct logicalVolIntegrityDescImpUse *lvidiu;
1989 struct timespec ts;
1989 1990
1990 if (!bh) 1991 if (!bh)
1991 return; 1992 return;
@@ -1997,8 +1998,8 @@ static void udf_open_lvid(struct super_block *sb)
1997 mutex_lock(&sbi->s_alloc_mutex); 1998 mutex_lock(&sbi->s_alloc_mutex);
1998 lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; 1999 lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
1999 lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; 2000 lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
2000 udf_time_to_disk_stamp(&lvid->recordingDateAndTime, 2001 ktime_get_real_ts(&ts);
2001 CURRENT_TIME); 2002 udf_time_to_disk_stamp(&lvid->recordingDateAndTime, ts);
2002 lvid->integrityType = cpu_to_le32(LVID_INTEGRITY_TYPE_OPEN); 2003 lvid->integrityType = cpu_to_le32(LVID_INTEGRITY_TYPE_OPEN);
2003 2004
2004 lvid->descTag.descCRC = cpu_to_le16( 2005 lvid->descTag.descCRC = cpu_to_le16(
@@ -2019,6 +2020,7 @@ static void udf_close_lvid(struct super_block *sb)
2019 struct buffer_head *bh = sbi->s_lvid_bh; 2020 struct buffer_head *bh = sbi->s_lvid_bh;
2020 struct logicalVolIntegrityDesc *lvid; 2021 struct logicalVolIntegrityDesc *lvid;
2021 struct logicalVolIntegrityDescImpUse *lvidiu; 2022 struct logicalVolIntegrityDescImpUse *lvidiu;
2023 struct timespec ts;
2022 2024
2023 if (!bh) 2025 if (!bh)
2024 return; 2026 return;
@@ -2030,7 +2032,8 @@ static void udf_close_lvid(struct super_block *sb)
2030 mutex_lock(&sbi->s_alloc_mutex); 2032 mutex_lock(&sbi->s_alloc_mutex);
2031 lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; 2033 lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
2032 lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; 2034 lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
2033 udf_time_to_disk_stamp(&lvid->recordingDateAndTime, CURRENT_TIME); 2035 ktime_get_real_ts(&ts);
2036 udf_time_to_disk_stamp(&lvid->recordingDateAndTime, ts);
2034 if (UDF_MAX_WRITE_VERSION > le16_to_cpu(lvidiu->maxUDFWriteRev)) 2037 if (UDF_MAX_WRITE_VERSION > le16_to_cpu(lvidiu->maxUDFWriteRev))
2035 lvidiu->maxUDFWriteRev = cpu_to_le16(UDF_MAX_WRITE_VERSION); 2038 lvidiu->maxUDFWriteRev = cpu_to_le16(UDF_MAX_WRITE_VERSION);
2036 if (sbi->s_udfrev > le16_to_cpu(lvidiu->minUDFReadRev)) 2039 if (sbi->s_udfrev > le16_to_cpu(lvidiu->minUDFReadRev))