From a23b50cdb55cb826b8745cbc37429c93f7b60c66 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Thu, 12 Aug 2021 16:22:22 -0700 Subject: [PATCH] mke2fs: warn about missing y2038 support when formatting fresh ext4 fs 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 Signed-off-by: Theodore Ts'o --- misc/mke2fs.c | 11 +++++++++++ misc/mke2fs.conf.5.in | 7 +++++++ misc/mke2fs.conf.in | 4 +--- tests/f_detect_xfs/expect | 1 + tests/f_detect_xfs/expect.nodebugfs | 1 + tests/f_resize_inode/expect | 1 + tests/m_64bit_flexbg/expect.1 | 1 + tests/m_dasd_bs/expect.1 | 1 + tests/m_desc_size_128/expect.1 | 1 + tests/m_extent_journal/expect.1 | 1 + tests/m_hugefile_slack/expect | 1 + tests/m_meta_bg/expect.1 | 1 + tests/m_mkfs_overhead/expect | 1 + tests/m_mmp/expect.1 | 1 + tests/m_no_opt/expect.1 | 1 + tests/m_raid_opt/expect.1 | 1 + tests/m_root_owner/expect.1 | 1 + tests/m_std/expect.1 | 1 + tests/m_uninit/expect.1 | 1 + tests/r_move_itable/expect | 1 + tests/r_resize_inode/expect | 2 ++ tests/t_enable_mcsum_ext3/expect | 1 + tests/t_iexpand_full/expect | 1 + tests/t_iexpand_mcsum/expect | 1 + tests/u_bounce_io/expect.1 | 1 + 25 files changed, 42 insertions(+), 3 deletions(-) diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 92003e1..a457397 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -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; diff --git a/misc/mke2fs.conf.5.in b/misc/mke2fs.conf.5.in index 08bb948..0b57030 100644 --- a/misc/mke2fs.conf.5.in +++ b/misc/mke2fs.conf.5.in @@ -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 diff --git a/misc/mke2fs.conf.in b/misc/mke2fs.conf.in index 01e35cf..0568099 100644 --- a/misc/mke2fs.conf.in +++ b/misc/mke2fs.conf.in @@ -12,16 +12,13 @@ } 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 } diff --git a/tests/f_detect_xfs/expect b/tests/f_detect_xfs/expect index a48e8af..a75637f 100644 --- a/tests/f_detect_xfs/expect +++ b/tests/f_detect_xfs/expect @@ -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 diff --git a/tests/f_detect_xfs/expect.nodebugfs b/tests/f_detect_xfs/expect.nodebugfs index d3b7935..26a8a4a 100644 --- a/tests/f_detect_xfs/expect.nodebugfs +++ b/tests/f_detect_xfs/expect.nodebugfs @@ -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 diff --git a/tests/f_resize_inode/expect b/tests/f_resize_inode/expect index db57ed6..d8815f3 100644 --- a/tests/f_resize_inode/expect +++ b/tests/f_resize_inode/expect @@ -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 diff --git a/tests/m_64bit_flexbg/expect.1 b/tests/m_64bit_flexbg/expect.1 index 956d248..27fc2a0 100644 --- a/tests/m_64bit_flexbg/expect.1 +++ b/tests/m_64bit_flexbg/expect.1 @@ -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: done diff --git a/tests/m_dasd_bs/expect.1 b/tests/m_dasd_bs/expect.1 index 970d556..dd327f0 100644 --- a/tests/m_dasd_bs/expect.1 +++ b/tests/m_dasd_bs/expect.1 @@ -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 diff --git a/tests/m_desc_size_128/expect.1 b/tests/m_desc_size_128/expect.1 index 1cd9758..eff741d 100644 --- a/tests/m_desc_size_128/expect.1 +++ b/tests/m_desc_size_128/expect.1 @@ -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 diff --git a/tests/m_extent_journal/expect.1 b/tests/m_extent_journal/expect.1 index 9a9219e..4dbf3be 100644 --- a/tests/m_extent_journal/expect.1 +++ b/tests/m_extent_journal/expect.1 @@ -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 diff --git a/tests/m_hugefile_slack/expect b/tests/m_hugefile_slack/expect index f740cdb..e2e2fd6 100644 --- a/tests/m_hugefile_slack/expect +++ b/tests/m_hugefile_slack/expect @@ -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 diff --git a/tests/m_meta_bg/expect.1 b/tests/m_meta_bg/expect.1 index 1b90b55..7574ebb 100644 --- a/tests/m_meta_bg/expect.1 +++ b/tests/m_meta_bg/expect.1 @@ -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 diff --git a/tests/m_mkfs_overhead/expect b/tests/m_mkfs_overhead/expect index adb8fd2..0fe845f 100644 --- a/tests/m_mkfs_overhead/expect +++ b/tests/m_mkfs_overhead/expect @@ -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 diff --git a/tests/m_mmp/expect.1 b/tests/m_mmp/expect.1 index 475cd1d..3acac85 100644 --- a/tests/m_mmp/expect.1 +++ b/tests/m_mmp/expect.1 @@ -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 diff --git a/tests/m_no_opt/expect.1 b/tests/m_no_opt/expect.1 index deaf22e..744f2bb 100644 --- a/tests/m_no_opt/expect.1 +++ b/tests/m_no_opt/expect.1 @@ -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 diff --git a/tests/m_raid_opt/expect.1 b/tests/m_raid_opt/expect.1 index 7536631..cf524f2 100644 --- a/tests/m_raid_opt/expect.1 +++ b/tests/m_raid_opt/expect.1 @@ -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 diff --git a/tests/m_root_owner/expect.1 b/tests/m_root_owner/expect.1 index 9c978b0..0c01bfc 100644 --- a/tests/m_root_owner/expect.1 +++ b/tests/m_root_owner/expect.1 @@ -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: done diff --git a/tests/m_std/expect.1 b/tests/m_std/expect.1 index a11cb9b..10bc617 100644 --- a/tests/m_std/expect.1 +++ b/tests/m_std/expect.1 @@ -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 diff --git a/tests/m_uninit/expect.1 b/tests/m_uninit/expect.1 index b60e8cc..fbb7edf 100644 --- a/tests/m_uninit/expect.1 +++ b/tests/m_uninit/expect.1 @@ -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 diff --git a/tests/r_move_itable/expect b/tests/r_move_itable/expect index cec0038..5976006 100644 --- a/tests/r_move_itable/expect +++ b/tests/r_move_itable/expect @@ -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) diff --git a/tests/r_resize_inode/expect b/tests/r_resize_inode/expect index ba1647e..cf45b76 100644 --- a/tests/r_resize_inode/expect +++ b/tests/r_resize_inode/expect @@ -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. diff --git a/tests/t_enable_mcsum_ext3/expect b/tests/t_enable_mcsum_ext3/expect index 549e60e..3bd2ccf 100644 --- a/tests/t_enable_mcsum_ext3/expect +++ b/tests/t_enable_mcsum_ext3/expect @@ -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 diff --git a/tests/t_iexpand_full/expect b/tests/t_iexpand_full/expect index 354818e..f99ab4b 100644 --- a/tests/t_iexpand_full/expect +++ b/tests/t_iexpand_full/expect @@ -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 diff --git a/tests/t_iexpand_mcsum/expect b/tests/t_iexpand_mcsum/expect index c24a245..354b117 100644 --- a/tests/t_iexpand_mcsum/expect +++ b/tests/t_iexpand_mcsum/expect @@ -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 diff --git a/tests/u_bounce_io/expect.1 b/tests/u_bounce_io/expect.1 index a11cb9b..10bc617 100644 --- a/tests/u_bounce_io/expect.1 +++ b/tests/u_bounce_io/expect.1 @@ -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 -- 1.8.3.1