From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (NAM04-DM6-obe.outbound.protection.outlook.com [40.107.102.70]) by mx.groups.io with SMTP id smtpd.web11.11087.1631289534326123346 for ; Fri, 10 Sep 2021 08:58:54 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nvidia.com header.s=selector2 header.b=kFowRVYH; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.102.70, mailfrom: jbrasen@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L2K5HMoxfR/kH6JxGPcGwGq865WdkqHV74dNowGZ5loC1qQLJH4Vl8gnZvX+lDbU91aL0abahrXwh6KUevzaOUZ28I/NIWD87JoFCUH+2WlU5uGUxvqE/znHjAFRk0gUPvRn9pZyuyMHlzF4LWyrrkcrxLAj+ogia1g/HcW59mvRME3If1H9eDwylMsVHvtVSis9k7DUh9LZTgseLlrxsWxIN235rM4JBG3agHC99/VuBXRvWlFDeOJUZMYlERNYnqeVNzjLVtIB6n09FEq44ZNm/LJmr1CfMLPhqSzDine37mZj1F/VcFszpu5GZ5WyQJFH9xTkvfnEm4tpgCUjbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=RImFf7H96ooLBfT5awutYXByrBCZRhB28AJr6aTRNMU=; b=lmOhxlgVHnqbLWJvyZoaZ8C3uFQONpAWN1iL2R2mX+8fiY5OhyGDIahB8irFFQOQ/+H4c+c8JmGPNDffjj+1Mc3KV0s/XBoMiaEqEGod8EGNLDOwk+D9HCRGU9yAf6xDvtgZY/PG6t4nEFoETmYf8UArESTZJScw0hu2G5vqrcoq5j9p04dN8IWKDsXdGk7Rj/Vvps8OFGIT3Q8F97nRHilmVnSi0jVlz2WP2M2VvTOF73iqwLspwJkQucKB4qIWcDy42vo/OyIikXRHcalFvyp1aSi5TsaX+FGWQgEnJCDTaZbKd4vKZoL/IM9YAzk0NxfPZLTEv8hm+pv2Zv0/uA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RImFf7H96ooLBfT5awutYXByrBCZRhB28AJr6aTRNMU=; b=kFowRVYHBR3JaqU2qSIVjNW5Nuv9jHfmMlHOI7gnxmiRdL0oYtThn+MA0UetHVYpIRyo0n2LnDeaBa1Y2vBpH4GFty3GD79BgEVSvK7G7byFKIJReUVIwD+IUicFA4/kxEqCVv1SaGEx+AYemSJqVmxlcfW3LH8+zOgMlLYSLtmhdtCC8vNV5BDCNeTuv2qN9WcjzvimdjuqnKJy9h56cKGs2zZz/S3xfvScKgcSXnhsqINL84frR2d4t+5vZWL2i1b7ZC2fE1HmCQf3uogu8HTeaLA+3I1ws6bF8Iv0x7NS3GvGSlc9iQScpxD1AfgI5tD5sIzBHr9IR62Fititbw== Received: from BN0PR04CA0065.namprd04.prod.outlook.com (2603:10b6:408:ea::10) by BY5PR12MB3780.namprd12.prod.outlook.com (2603:10b6:a03:1a2::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Fri, 10 Sep 2021 15:58:51 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ea:cafe::18) by BN0PR04CA0065.outlook.office365.com (2603:10b6:408:ea::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17 via Frontend Transport; Fri, 10 Sep 2021 15:58:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4500.14 via Frontend Transport; Fri, 10 Sep 2021 15:58:49 +0000 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 10 Sep 2021 15:58:43 +0000 Received: from build-jbrasen-20210819T103534360.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Fri, 10 Sep 2021 15:58:43 +0000 From: "Jeff Brasen" To: CC: , Jeff Brasen Subject: [PATCH v2 2/2] Ext4Pkg: Support uncleanly unmounted filesystems Date: Fri, 10 Sep 2021 15:58:39 +0000 Message-ID: <330849752fdf246f7182db697be6f62f5cc335a3.1631289393.git.jbrasen@nvidia.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 In-Reply-To: References: X-NVConfidentiality: public Return-Path: jbrasen@nvidia.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0c9c4a34-d2ca-4375-3f9c-08d97473e158 X-MS-TrafficTypeDiagnostic: BY5PR12MB3780: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2331; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8o0X+ZAOp46bqpbDm72cpDbi4ZbdBCdhtYlJKtq01EtZ5suGpAf7tw129+YWekasbmawa0iVLUfubgU4zKdGEhc57N4zZpEQxOjLJbj/ztwvE0pceMwXYbuFVRqbIW+iT7E3Q8lRLGyxCe7VsvvjlhUKMHFDb41azm7xhTnf8Nbjs7LZg9RD9kbkOw6lccSnLWAWbh+PHM4EpxokqOafuY/JgeO6tUUhnsqExTc7a+oI4YudPEazeb803GgLJ30ABFMcPXFjA5pAOpmfH6fQ8Y9NL4KVyTws4fIEykG45bbTiZoVtXbBF3/yK+aDrP83OZQ1vnw0bOkhDxGsLBubfVcbTrJKIIKUX9Lnbyg+A6FJ0Z3O3lK68onKqmqUYBO05KitpDjI2CEcgwF/nubMCgDwOINHYaOLbrl2ZgIx99IqjEiijBzsHVswAbye6hrqE3qGMPxigh8rZsvxElqsyyehrJe9nPyGjhvHezBlUjpStYC19oudWV4Z+9GkkxnMjn95q/7uFkaaoiPLeJ1al34J+YsY9A39ZdxjhnePzzkEZjyZBPephPYz2aQx90ZdZdx6yqngAIozTweDXz36g9qTyU4ac7zBSwNcCOb9jXFdUgBYfomXs6UWi3oMZIRx/oEPlfT32fVF9BIDXw+AtzwqQO9o1orzfyi6D2EeUNEwatNkbD3L9JweWvGu5/UDLx2z/tX1Kn/NzgPZoaVQru5mc+y0qJ62tsydX4NVz3s= X-Forefront-Antispam-Report: CIP:216.228.112.35;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:schybrid04.nvidia.com;CAT:NONE;SFS:(4636009)(39860400002)(376002)(396003)(346002)(136003)(46966006)(36840700001)(2616005)(36860700001)(356005)(82310400003)(86362001)(6666004)(36756003)(336012)(316002)(426003)(7696005)(7636003)(70586007)(8676002)(82740400003)(70206006)(478600001)(26005)(2906002)(4326008)(8936002)(186003)(107886003)(54906003)(83380400001)(5660300002)(6916009)(19627235002)(47076005)(32563001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2021 15:58:49.8365 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c9c4a34-d2ca-4375-3f9c-08d97473e158 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.112.35];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3780 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Support for uncleanly mounted filesystems, if there is a recovery journal mark filesystem as read-only. Signed-off-by: Jeff Brasen --- Features/Ext4Pkg/Ext4Dxe/Superblock.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Features/Ext4Pkg/Ext4Dxe/Superblock.c b/Features/Ext4Pkg/Ext4D= xe/Superblock.c index 1ceb0d5cbb..251babb320 100644 --- a/Features/Ext4Pkg/Ext4Dxe/Superblock.c +++ b/Features/Ext4Pkg/Ext4Dxe/Superblock.c @@ -18,7 +18,7 @@ STATIC CONST UINT32 gSupportedIncompatFeat =3D EXT4_FEATURE_INCOMPAT_64BIT | EXT4_FEATURE_INCOMPAT_DIRDATA | EXT4_FEATURE_INCOMPAT_FLEX_BG | EXT4_FEATURE_INCOMPAT_FILETYPE | EXT4_FEATURE_INCOMPAT_EXTENTS | EXT4_FEATURE_INCOMPAT_LARGEDIR | - EXT4_FEATURE_INCOMPAT_MMP; + EXT4_FEATURE_INCOMPAT_MMP | EXT4_FEATURE_INCOMPAT_RECOVER; =20 // Future features that may be nice additions in the future: // 1) Btree support: Required for write support and would speed up lookups= in large directories. @@ -89,10 +89,8 @@ Ext4SuperblockValidate ( return FALSE; } =20 - // Is this correct behaviour? Imagine the power cuts out, should the sys= tem fail to boot because - // we're scared of touching something corrupt? if ((Sb->s_state & EXT4_FS_STATE_UNMOUNTED) =3D=3D 0) { - return FALSE; + DEBUG ((DEBUG_WARN, "[ext4] Filesystem was not unmounted cleanly\n")); } =20 return TRUE; @@ -215,6 +213,11 @@ Ext4OpenSuperblock ( return EFI_UNSUPPORTED; } =20 + if (EXT4_HAS_INCOMPAT (Partition, EXT4_FEATURE_INCOMPAT_RECOVER)) { + DEBUG ((DEBUG_WARN, "[ext4] Needs journal recovery, mounting read-only= \n")); + Partition->ReadOnly =3D TRUE; + } + // At the time of writing, it's the only supported checksum. if (Partition->FeaturesCompat & EXT4_FEATURE_RO_COMPAT_METADATA_CSUM && Sb->s_checksum_type !=3D EXT4_CHECKSUM_CRC32C) { --=20 2.17.1