From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (NAM12-BN8-obe.outbound.protection.outlook.com [40.107.237.72]) by mx.groups.io with SMTP id smtpd.web10.58.1631311893683407208 for ; Fri, 10 Sep 2021 15:11:34 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nvidia.com header.s=selector2 header.b=Ai0VlrSl; 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.237.72, mailfrom: jbrasen@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fo5eQkJISL/HkgqOacvS5l+NpiRC/gwEzHT8ChYa8HOTyDl5gGvV2Wz7DZHQ0fOpTjzBdy6cH4ycE9vqtTj8PLn5yRieKrMjJN/OZi60c8YyU5Te1+iNt1xotLRY+bwVsLk4t8UuMCiqcemokyC0DooKcL1L4Kg5b7k6u9lqk4CLPO6aFbaYN0KK1NFxfCXJSKo6dLFdAQkYqVr+/ciXVmdGD5dET1yKb5BQ28t+CRuIMTz82yMdsGkzbCSsSSGB1kWgxDAL1pbPdgG3pazS0P98Yay0EHGSyOpwmJjHLuEmGR3MUznnhq4gwtCTyikX7mzPimKQIKXkdluGBRYaRg== 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=CuWj2326Tgpq88QPx3yGbwn76V/sJyMFfOysgbSGiNc=; b=DTYajiB74IpEvErmqqXi4vqtcN0MoYI1tvvKNH+ZSKMPPnqtArthJCFRhQdu91nJCoSSr3U6GsJ2S1RUYmTsaGAAp1z2G8b3AUGfCBLijegufWsvXjnfs3T7yLKRaVMBYOH3KiXu982rlPQdQKQIRsAEAvEYGC2SB8dXeglct5PUrMWfoLX+RQKyvhEv5+fJp3ZOsvazphHBOW20DZmRJ6IZKU24bqsNBmA5F7Rnlr0OxwcH7yp2q0eMj1QJ0aVScylt1Tl++kuFpjE2UFKZlJcKNCu+vrTFxQCRjjOJvNdl0AwOn6yWmfHmzuTAtaEPUuUPpL9lZtkeCFXWyuzUpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) 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=CuWj2326Tgpq88QPx3yGbwn76V/sJyMFfOysgbSGiNc=; b=Ai0VlrSlKv1qlJSRQ/GMaXXLGjzgQ2b1dp2aPx6+ehxbBYzE9fIwpa1YP/dy+ZdqWkXThN76J+XSq4lGY0Aoi/HvWkXkEPfjC4TDVOcB2TNqXhCYkhLxc7UF0x/62khE1NXjirfj5O8InlIcIzlyJ/Tv4EAP6+Z47u8F1t5xno+IRx/N+6XUHM9DbejjTOejgHif6EmPMtoeotFlrq9q+xyswDJjADfyknNODe9oyo1Yt6Q4kF1Mgc2onFCC2RioKWCvHRJF1MhRo+1iE1zETo5ktV42Bt82wz0j312dmBUBF8Fg9DL93bUbqkzsC1LKTqXH/vSAgrTb8CAXvRaXBg== Received: from BN6PR17CA0007.namprd17.prod.outlook.com (2603:10b6:404:65::17) by DM6PR12MB4403.namprd12.prod.outlook.com (2603:10b6:5:2ab::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Fri, 10 Sep 2021 22:11:32 +0000 Received: from BN8NAM11FT049.eop-nam11.prod.protection.outlook.com (2603:10b6:404:65:cafe::1e) by BN6PR17CA0007.outlook.office365.com (2603:10b6:404:65::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Fri, 10 Sep 2021 22:11:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT049.mail.protection.outlook.com (10.13.177.157) 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 22:11:31 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 10 Sep 2021 22:11:31 +0000 Received: from build-jbrasen-20210819T103534360.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.15) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Fri, 10 Sep 2021 15:11:31 -0700 From: "Jeff Brasen" To: CC: , Jeff Brasen Subject: [PATCH v3 2/2] Ext4Pkg: Support uncleanly unmounted filesystems Date: Fri, 10 Sep 2021 22:11:28 +0000 Message-ID: <430b461e51dcb77505e4299c0cd3f462d2791e90.1631311760.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: 2c6c14a4-b61f-46b6-cae2-08d974a7f234 X-MS-TrafficTypeDiagnostic: DM6PR12MB4403: 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: cZbol0mIoTY+6ikxDm0jFRhmjWTT6LLP7waeaqH5kQJc+X6S/pj9gwqe+cHZf67k1YpGmkuJJai3kxmneagU0Z3boinNLh0vI48fQIs7RF/QpwhSJwYDV2RXa6fX3a8WuSgiQwoN2xZBnQvgEmjVgTt+8kfq8jAPlwVBJphWYsQY8Z9rOpI9o7TpE5JXnOygZeVY7ovTYuDXk8jqb+ou5/1Di2VgjCi0MIOfmfrTKTd5HzU+pthZqe8U9xvRmdNjFEJgfk0FxB0khGGO+Cdile5Q5+Q0LDM5cb9WfA+P2SD/3uW6JevDO6E3M8If33WTq2athFBQ/yCCiIep9bzLhTZB5TctF0nq5tpYEhJVFlx+KAwkArwIbM0p9xjxVvvlaB4HeBGsuT/LDGU94MJ9an7gbD4zzWF3t2nu88+Sz0z9kw88E3YxNqJwm/8ICuv5of3KIwIWbO3boOmCc0+wDJl0w3arI7qKN3LPSz67/lYD8I8xtWcYvWQiCEXSC01Js+OzfvhetJQXs8/+k4g0xmtGlKrNKXwyb8tAhSvq9zv7gqE1C1y+z8RNTi+xhDC1tWgnSgat+4XezukD15dCNnNFMhU0mz5gh3jLaMy2H1EO0clvM/vMWgypdCgOCvakVH5hcTDWDrgQ+sI8P7vqNiHuxmc1iE1XnsJORlRHrimMFlHPj1sw2/wfofavwoHXZtfWJxlHmbHY5ygy3L54SEfMRbzVEmCs9mqqhZcX7p0= X-Forefront-Antispam-Report: CIP:216.228.112.34;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:schybrid03.nvidia.com;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(7636003)(47076005)(356005)(316002)(8676002)(82310400003)(36756003)(83380400001)(86362001)(70206006)(36860700001)(4326008)(6916009)(2906002)(6666004)(107886003)(54906003)(508600001)(8936002)(5660300002)(2616005)(36906005)(336012)(186003)(426003)(19627235002)(26005)(7696005)(70586007)(32563001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2021 22:11:31.9823 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c6c14a4-b61f-46b6-cae2-08d974a7f234 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.34];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT049.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4403 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 0c965415c5..9c3f7a9e7b 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