Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp129989pxt; Wed, 11 Aug 2021 16:34:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyp+1R8TyanxieA7DJGUyTd3TjPnO7mJSP55M9HkI7fSbdXrlYT9zRmT7GrdsxT3BEanev2 X-Received: by 2002:a05:6602:2e0e:: with SMTP id o14mr789894iow.161.1628724867659; Wed, 11 Aug 2021 16:34:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628724867; cv=none; d=google.com; s=arc-20160816; b=SuE9ap2E++ild430qLlwZdYrAL48ahkJyzOBxg0RV6sZVA9ZDu0mhXs2y2I1Lljf8w bXdpSWbPs6DVMKl8uVMtmz0gV3MuQ8EkRMClAIW53g/kcsYHR4pW3bx7keL77hJ5/gQS NCfYgmgPEMiyH8d2W1O02cNZ05HFHunXHpXX0EpJQW5dV83k+hlE4NhRCaJ23WR0cCiK t/bde6ghbK1ENqWri8NeM6zU3nGq1qzXA5thVZotswKZRZipSysEPpFU0vC3VcPFRd1K AqtU8Pnh96Y7rCeMHs8vgMX7U7feD8RkM8Q/p3T27UR9lNqubsu7/snRFkPfBRmVFzGG dSTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=bKNnbWiqzIluKgdDYKx2PACZ2131HE0LE6L0NgN4Bps=; b=xz0MKCbin9PmJalLqd5JDGIz3RB3zeF7Ni8X64IEfJKfxFtMbShPMeuqwmBt3Wyex5 UpJPmoRHgDxEvrjf1uDA6yeGVBQs7w4cNAM93tydW3k5YVM99iuPlrjtlCso0hUNleTO 41WLEMx6RHpnM8YSLUYHE4FlQ+ZhIWc90zqeHSKdM23ZXIrSQgPciNnp0tf0bSUOE8ul 3nJVp7buubTS0AwtueXsXJxoeoU/78ujiX7UKKpmYW4A747h3Oj2J4fRb3ZTKDlFChH8 xVkPv4ihusdn5zkMqduSZBsbNpOzW/QMQcEVb9wKf37MmaYHlIWr8kiZhIyWE9FhwFsk obdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iqCVojis; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u26si1106266jam.6.2021.08.11.16.34.10; Wed, 11 Aug 2021 16:34:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iqCVojis; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232664AbhHKXdS (ORCPT + 99 others); Wed, 11 Aug 2021 19:33:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:46234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232470AbhHKXdS (ORCPT ); Wed, 11 Aug 2021 19:33:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A924A60E52; Wed, 11 Aug 2021 23:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628724773; bh=BNegfWbn0FRBCYIUVHxxfej7z9/3cEFe82zvevU9uN0=; h=Date:From:To:Cc:Subject:From; b=iqCVojisgFqhKE/O4gdkMYZKGxsnqcTrO3hYyAEyK6PcPRVIJxQXe1GUTGmNnIYrK pQvJTh3Ju178C+6MV5tvMJ0Nk/gmXk7Pbr9p/RPY8AHL2mWwvMo4na83U1OsOjvP/r 6fbvVZVQ1GbLXtwdChaTZzuPWDUAvbE6/3At8NCpxGCTFB4Ullr7CeXyRUwQsF/6l4 wxcxxrxbyirnhIH/kQirsyVAQyqziH6EbUPf/uI/5pYnNLNQmv1za2rMB7kp6oxSHN vIebu8bEwtU/cQ5S9rWpHXhtagZ+N+5+g+rfDBVnXM/kO7AwEag8lcnbxqM4TvB6+E o+aX4mnojGUoQ== Date: Wed, 11 Aug 2021 16:32:53 -0700 From: "Darrick J. Wong" To: Theodore Ts'o Cc: linux-ext4 Subject: [PATCH] mke2fs: warn about missing y2038 support when formatting fresh ext4 fs Message-ID: <20210811233253.GC3601392@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Darrick J. Wong 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. First, change the mke2fs.conf file to specify 256-byte inodes even for small filesystems, then add a warning to mke2fs itself if someone is trying to make us format an ext4 filesystem with 128-byte inodes. Note that we /don't/ warn about these things if the user has signalled that they want an old format such as ext2, ext3, or hurd. Everyone should know by now that those are legacy. Signed-off-by: Darrick J. Wong --- misc/mke2fs.c | 35 +++++++++++++++++++++++++++++++++++ misc/mke2fs.conf.in | 4 ++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 92003e11..b16880c2 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -1537,6 +1537,30 @@ static int get_device_geometry(const char *file, } #endif +/* + * Returns true if the user is forcing an old format (e.g. ext2, ext3). + * + * If there is no fs_types list, the user invoked us with no explicit type and + * gets the default (ext4) format. If we find the latest format (ext4) in the + * type list, some combination of program name and -T argument put us in ext4 + * mode. Anything else (ext2, ext3, hurd) and we return false. + */ +static inline int +old_format_forced(char **fs_types) +{ + int found_ext4 = 0; + int i; + + if (!fs_types) + return 0; + + for (i = 0; fs_types[i]; i++) + if (!strcmp(fs_types[i], "ext4")) + found_ext4 = 1; + + return !found_ext4; +} + static void PRS(int argc, char *argv[]) { int b, c, flags; @@ -2603,6 +2627,17 @@ static void PRS(int argc, char *argv[]) exit(1); } + /* If the user didn't tell us to format with an old ondisk format... */ + if (!old_format_forced(fs_types)) { + /* + * ...warn them that filesystems with 128-byte inodes will not + * work properly beyond 2038. + */ + if (inode_size == EXT2_GOOD_OLD_INODE_SIZE) + 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.in b/misc/mke2fs.conf.in index 01e35cf8..2fa1a824 100644 --- a/misc/mke2fs.conf.in +++ b/misc/mke2fs.conf.in @@ -16,12 +16,12 @@ } small = { blocksize = 1024 - inode_size = 128 + inode_size = 256 inode_ratio = 4096 } floppy = { blocksize = 1024 - inode_size = 128 + inode_size = 256 inode_ratio = 8192 } big = {