isofs: Initialize filesystem timestamp ranges
authorDeepa Dinamani <deepa.kernel@gmail.com>
Sun, 23 Jun 2019 23:17:10 +0000 (16:17 -0700)
committerDeepa Dinamani <deepa.kernel@gmail.com>
Fri, 30 Aug 2019 15:11:25 +0000 (08:11 -0700)
Fill in the appropriate limits to avoid inconsistencies
in the vfs cached inode times when timestamps are
outside the permitted range.

Reference: http://www.ecma-international.org/publications/standards/Ecma-119.htm

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Acked-by: Jeff Layton <jlayton@kernel.org>
fs/isofs/inode.c

index 9e30d8703735cfeca35a4746ee3b18814f31a61f..62c0462dc89f3e52d88edb162717d80091c239a5 100644 (file)
@@ -30,6 +30,9 @@
 #include "isofs.h"
 #include "zisofs.h"
 
+/* max tz offset is 13 hours */
+#define MAX_TZ_OFFSET (52*15*60)
+
 #define BEQUIET
 
 static int isofs_hashi(const struct dentry *parent, struct qstr *qstr);
@@ -801,6 +804,10 @@ root_found:
         */
        s->s_maxbytes = 0x80000000000LL;
 
+       /* ECMA-119 timestamp from 1900/1/1 with tz offset */
+       s->s_time_min = mktime64(1900, 1, 1, 0, 0, 0) - MAX_TZ_OFFSET;
+       s->s_time_max = mktime64(U8_MAX+1900, 12, 31, 23, 59, 59) + MAX_TZ_OFFSET;
+
        /* Set this for reference. Its not currently used except on write
           which we don't have .. */