]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
mke2fs: warn about missing y2038 support when formatting fresh ext4 fs
authorDarrick J. Wong <djwong@kernel.org>
Thu, 12 Aug 2021 23:22:22 +0000 (16:22 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 14 Aug 2021 19:10:42 +0000 (15:10 -0400)
Filesystems with 128-byte inodes do not support timestamps beyond the
year 2038.  Since we're now less than 16.5 years away from that point,
it's time to start warning users about this lack of support when they
format an ext4 filesystem with small inodes.

(Note that even for ext2 and ext3, we changed the default for
non-small file systems in 2008 in commit commit b1631cce648e ("Create
new filesystems with 256-byte inodes by default").)

So change the mke2fs.conf file to specify 256-byte inodes even for
small filesystems, and then add a warning to mke2fs itself if someone
is trying to make us format a file system with 128-byte inodes.  This
can be suppressed by setting the boolean option warn_y2038_dates in
the mke2fs.conf file to false, which we do in the case of GNU Hurd,
since it only supports 128 byte inodes as of this writing.

[ Patch reworked by tytso to only warn in the case of GNU Hurd, since
  the default for ext2/ext3 was changed for all but small file systems
  in 2008. ]

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
25 files changed:
misc/mke2fs.c
misc/mke2fs.conf.5.in
misc/mke2fs.conf.in
tests/f_detect_xfs/expect
tests/f_detect_xfs/expect.nodebugfs
tests/f_resize_inode/expect
tests/m_64bit_flexbg/expect.1
tests/m_dasd_bs/expect.1
tests/m_desc_size_128/expect.1
tests/m_extent_journal/expect.1
tests/m_hugefile_slack/expect
tests/m_meta_bg/expect.1
tests/m_mkfs_overhead/expect
tests/m_mmp/expect.1
tests/m_no_opt/expect.1
tests/m_raid_opt/expect.1
tests/m_root_owner/expect.1
tests/m_std/expect.1
tests/m_uninit/expect.1
tests/r_move_itable/expect
tests/r_resize_inode/expect
tests/t_enable_mcsum_ext3/expect
tests/t_iexpand_full/expect
tests/t_iexpand_mcsum/expect
tests/u_bounce_io/expect.1

index 92003e11955809a883bca11023a35980f59b03f9..a457397281987e799bde1d2b8741ff2973efc45b 100644 (file)
@@ -2603,6 +2603,17 @@ profile_error:
                exit(1);
        }
 
+       /*
+        * Warn the user that filesystems with 128-byte inodes will
+        * not work properly beyond 2038.  This can be suppressed via
+        * a boolean in the mke2fs.conf file, and we will disable this
+        * warning for file systems created for the GNU Hurd.
+        */
+       if (inode_size == EXT2_GOOD_OLD_INODE_SIZE &&
+           get_bool_from_profile(fs_types, "warn_y2038_dates", 1))
+               printf(
+_("128-byte inodes cannot handle dates beyond 2038 and are deprecated\n"));
+
        /* Make sure number of inodes specified will fit in 32 bits */
        if (num_inodes == 0) {
                unsigned long long n;
index 08bb948886db943ba2e253a06b0535cb957622fe..0b57030320eb1a4572a9f65ad58ae2bbdc2b841f 100644 (file)
@@ -505,6 +505,13 @@ This relation specifies the base file name for the huge files.
 This relation specifies the (zero-padded) width of the field for the
 huge file number.
 .TP
+.I warn_y2038_dates
+This boolean relation specifies wheather mke2fs will issue a warning
+when creating a file system with 128 byte inodes (and so therefore will
+not support dates after January 19th, 2038).  The default value is true,
+except for file systems created for the GNU Hurd since it only supports
+128-byte inodes.
+.TP
 .I zero_hugefiles
 This boolean relation specifies whether or not zero blocks will be
 written to the hugefiles while
index 01e35cf8315007b42a5c78475e776bfac58ad8f6..056809927f3624173d7e303ec59e940cf74b18a9 100644 (file)
        }
        ext4 = {
                features = has_journal,extent,huge_file,flex_bg,metadata_csum,64bit,dir_nlink,extra_isize
-               inode_size = 256
        }
        small = {
                blocksize = 1024
-               inode_size = 128
                inode_ratio = 4096
        }
        floppy = {
                blocksize = 1024
-               inode_size = 128
                inode_ratio = 8192
        }
        big = {
@@ -44,4 +41,5 @@
        hurd = {
             blocksize = 4096
             inode_size = 128
+            warn_y2038_dates = 0
        }
index a48e8afcaf106de99f223a8838f473421d6bb938..a75637fbd8de1225927db9c4738dfecf8df581ab 100644 (file)
@@ -19,6 +19,7 @@ test.img contains a xfs file system labelled 'test_filsys'
 ../misc/tune2fs: Bad magic number in super-block while trying to open test.img
 test.img contains a xfs file system labelled 'test_filsys'
 *** mke2fs
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 16384 1k blocks and 4096 inodes
 Superblock backups stored on blocks: 
        8193
index d3b7935803529534c8b560c973bea028caef1972..26a8a4afc244af739f65324c8a6c9a8c0c4f5e9a 100644 (file)
@@ -17,6 +17,7 @@ test.img contains a xfs file system labelled 'test_filsys'
 ../misc/tune2fs: Bad magic number in super-block while trying to open test.img
 test.img contains a xfs file system labelled 'test_filsys'
 *** mke2fs
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 16384 1k blocks and 4096 inodes
 Superblock backups stored on blocks: 
        8193
index db57ed651ab0c8ecc360cd7d595afc965196cf22..d8815f3b0f8f00d14250435e72d27997be43ca0b 100644 (file)
@@ -1,4 +1,5 @@
 mke2fs -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 16384
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 16384 1k blocks and 4096 inodes
 Superblock backups stored on blocks: 
        1025, 3073, 5121, 7169, 9217
index 956d24854e4958e147488d6fcecd7bb0e6acc7a7..27fc2a0bc7c13d0335f54630b7dee9630b69c4ad 100644 (file)
@@ -1,3 +1,4 @@
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 1024 1k blocks and 128 inodes
 
 Allocating group tables:    \b\b\bdone                            
index 970d556dd4f80c2ce1cd72339846bcb509dc0372..dd327f0dab540077519c7d7d858a25a947a5d40e 100644 (file)
@@ -1,3 +1,4 @@
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 32768 2k blocks and 16384 inodes
 Superblock backups stored on blocks: 
        16384
index 1cd9758f9eb60463efb7c1e193524572b0416ca9..eff741ddb6166d24ab6a288d9e00ce52b694fbe9 100644 (file)
@@ -1,3 +1,4 @@
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 131072 1k blocks and 8192 inodes
 Superblock backups stored on blocks: 
        1025, 3073, 5121, 7169, 9217, 25601, 27649, 50177, 82945, 128001
index 9a9219e95b31221fb419e89748f7fc05952791ab..4dbf3be2356430d6fa33a22d5efa70b3b98fb9da 100644 (file)
@@ -1,3 +1,4 @@
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 65536 1k blocks and 16384 inodes
 Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345
index f740cdb9eb681cf4b2d97adfd729e89c4d810751..e2e2fd6296fa0b13f5b1bc33510480089806959b 100644 (file)
@@ -1,4 +1,5 @@
 mke2fs -F -T ext4h -I 128 test.img 786432
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 786432 1k blocks and 98304 inodes
 Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553
index 1b90b554389cdf8b24f0470f2e68abca303cb7e2..7574ebbd30043ffb0a525d4ccd553d1f83ee4e9e 100644 (file)
@@ -1,3 +1,4 @@
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 131072 1k blocks and 32768 inodes
 Superblock backups stored on blocks: 
        1025, 3073, 5121, 7169, 9217, 25601, 27649, 50177, 82945, 128001
index adb8fd2f5ced5164f07caa91861c297564f061fd..0fe845f30e1be5c523cb37cde5bf375965552e18 100644 (file)
@@ -1 +1,2 @@
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 test.img: Cannot create filesystem with requested number of inodes while setting up superblock
index 475cd1d08310ffc859ff9da29a4f379b45a40aac..3acac85a58a5902e58cb60f361feb6f24328c94f 100644 (file)
@@ -1,3 +1,4 @@
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 65536 4k blocks and 65536 inodes
 Superblock backups stored on blocks: 
        32768
index deaf22ef3265f0925af90e2eb217399e24c65483..744f2bb8a77d837b4aa2a33a6f2d91b30de3f113 100644 (file)
@@ -1,3 +1,4 @@
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 65536 1k blocks and 16384 inodes
 Superblock backups stored on blocks: 
        8193, 16385, 24577, 32769, 40961, 49153, 57345
index 75366312122da8d32746255884df762b91d90549..cf524f2a197c4164c3d9b2206f625cbaaa207b0b 100644 (file)
@@ -1,3 +1,4 @@
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 131072 1k blocks and 32768 inodes
 Superblock backups stored on blocks: 
        1025, 3073, 5121, 7169, 9217, 25601, 27649, 50177, 82945, 128001
index 9c978b02199bfb89e69e1acedd1a7c6924d8b0a3..0c01bfc10024061991c2980649d9d40186ffd4ce 100644 (file)
@@ -1,3 +1,4 @@
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 1024 1k blocks and 128 inodes
 
 Allocating group tables:    \b\b\bdone                            
index a11cb9bc7759b0ecbb120904ccf3930bca37a76d..10bc6173d39c80bee8d7dded99419a5220f202b2 100644 (file)
@@ -1,3 +1,4 @@
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 65536 1k blocks and 16384 inodes
 Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345
index b60e8cc812962c9d6763050dead22f226c537a9f..fbb7edfdf8ced066baebfcd2b7807ec8ba342d65 100644 (file)
@@ -1,3 +1,4 @@
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 131072 1k blocks and 32768 inodes
 Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345, 73729
index cec0038ae6fe981e78f06edec7f28658ca7cd0f6..59760062ed1787ac0cbe9869ded73458261681ac 100644 (file)
@@ -1,4 +1,5 @@
 mke2fs -q -F -o Linux -b 1024 -g 256 test.img 1024
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 resize2fs -p test.img 10000
 Resizing the filesystem on test.img to 10000 (1k) blocks.
 Begin pass 1 (max = 35)
index ba1647ea72c26f41bee56c241e8e3216fb882089..cf45b76a327c59e95d33abe648095e9958b9e3c4 100644 (file)
@@ -1,4 +1,5 @@
 mke2fs -q -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 16384
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 resize2fs test.img 65536
 Resizing the filesystem on test.img to 65536 (1k) blocks.
 The filesystem on test.img is now 65536 (1k) blocks long.
@@ -446,6 +447,7 @@ Group 63: (Blocks 64513-65535)
   Free inodes: 16129-16384
 --------------------------------
 mke2fs -q -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 65536
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 resize2fs test.img 16384
 Resizing the filesystem on test.img to 16384 (1k) blocks.
 The filesystem on test.img is now 16384 (1k) blocks long.
index 549e60e93a4e24d3088ba8243511620344ef1b74..3bd2ccf1b69610a4b03afa9909a307dbf792b2c7 100644 (file)
@@ -1,4 +1,5 @@
 tune2fs metadata_csum test
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 524288 1k blocks and 65536 inodes
 Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
index 354818e260c6b5b004c8e8677330ff90ddfe2eab..f99ab4bb4195e8674d3e37a75cfa63d6c28eed66 100644 (file)
@@ -1,4 +1,5 @@
 tune2fs test
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 786432 1k blocks and 98304 inodes
 Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553
index c24a245692a986cf4fc9ffc4d2da8ceab7637ab5..354b1179bc70d908ee80dd3e110d9167a6be07b9 100644 (file)
@@ -1,4 +1,5 @@
 tune2fs test
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 786432 1k blocks and 98304 inodes
 Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553
index a11cb9bc7759b0ecbb120904ccf3930bca37a76d..10bc6173d39c80bee8d7dded99419a5220f202b2 100644 (file)
@@ -1,3 +1,4 @@
+128-byte inodes cannot handle dates beyond 2038 and are deprecated
 Creating filesystem with 65536 1k blocks and 16384 inodes
 Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345