From nobody Sun May 19 03:02:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+80511+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631311894915220.49678562875852; Fri, 10 Sep 2021 15:11:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id UK6zYY1788612xX5fBi93drr; Fri, 10 Sep 2021 15:11:34 -0700 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.42]) by mx.groups.io with SMTP id smtpd.web12.64.1631311893425720120 for ; Fri, 10 Sep 2021 15:11:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eEk4ohSAYL0PBjGXidJg3M2C5gnqWF1wMmUBPJgvuuIpikajI7imU8DNobc8liivEdiV9BiVYgcpPKpM4BjeyK+Kr5q47FO6mSSMRLRwSNlpCzec6mHg8COGy1DpMSI7/P5E47Htts0xh195iHSqH/vjppWXTEjAG6pP+ioOUKmZLSkpAHpkZuzGHHpUs/7RZvBtZ5/QLDytY3DanJZN8HwsmGQ3Tc9XXUH3EXHNNDODwh1WnRuLaQigTy9l0hg373qEyNQmnhx/4YRsNi063vjzcoWyNtKKEYLZI5iqIfhMCgYkJHGsAznBU3KmgQzf3HdeIYPRmL2PhPSf/yN2SA== 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=VlMlp77t03RusEQCklH2SFeFCKSXYzdex+iWtVb1ooo=; b=e3Lb3dnmp+QOUJVDOk28LjIqI2HcsazbVnFBI69zVs7Y7FjjiDr5KqdBqGvhXOzT58IHaxxyqbTHqUNQVDVvDwEaBts29JaNKedRKOUa8VZD2Xz+s56K8S27adEhOzngSTsK96NQL4pnp4Lx4Pn52oJEpWgqIrhT+ajhRNzj3njtCYEPi9EhdR8gqjp0sZNYAk7DM40i+z/D0B1OG8jd8tIsJH8ZCAbQMXmOkOYD6/Zj+oA8UrA8AlQXyr4EqZfYE6Kw4fdJ8o+4z8EAIihmyzynlLWAkj3RRTQRNaIcrAxVFPQeGAe5idlY7kBT4z/6vX7slDgLUwDtGRRnZoFRxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=edk2.groups.io 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 X-Received: from MW2PR2101CA0026.namprd21.prod.outlook.com (2603:10b6:302:1::39) by BN9PR12MB5209.namprd12.prod.outlook.com (2603:10b6:408:11a::22) 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 22:11:32 +0000 X-Received: from CO1NAM11FT063.eop-nam11.prod.protection.outlook.com (2603:10b6:302:1:cafe::22) by MW2PR2101CA0026.outlook.office365.com (2603:10b6:302:1::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.0 via Frontend Transport; Fri, 10 Sep 2021 22:11:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=pass action=none header.from=nvidia.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+80511+1787277+3901457@groups.io; helo=mail02.groups.io; 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; X-Received: from mail.nvidia.com (216.228.112.35) by CO1NAM11FT063.mail.protection.outlook.com (10.13.175.37) 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 X-Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 10 Sep 2021 22:11:31 +0000 X-Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 10 Sep 2021 22:11:30 +0000 X-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:30 -0700 From: "Jeff Brasen via groups.io" To: CC: , Jeff Brasen Subject: [edk2-devel] [PATCH v3 1/2] Ext4Pkg: Improve Ext4IsBindingSupported() behavior Date: Fri, 10 Sep 2021 22:11:27 +0000 Message-ID: <7631e4dcf3c01613ca24d3acd9b4bd5d09fa8126.1631311760.git.jbrasen@nvidia.com> MIME-Version: 1.0 In-Reply-To: References: X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2540866b-fa01-4264-a58d-08d974a7f1f4 X-MS-TrafficTypeDiagnostic: BN9PR12MB5209: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:486; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: kYQCklEnwl190MF6iPoKQ1LD6t9Y2wwqYropAVPsdUhwlGz4HdkWtaQE62eWEB2C4PMNYvDR4CrSEDlrKb5iPRpWALBJ0jz6Eln3lllM0i6JMBjkMpLPfSoeo/JHyI6HSv/0ml1p4zEHvubO9OZN0T5QppTZpWahxAoAEEE13USz6nGWp2Vn20dIcoueCsWAi/BZw1bsSyOqVnXss8LbESkvasHobO+hgv7KPqquGuuXw2s4Z4NzJIISVDMsAR8LLHZY2KgMiG+Mvxdst6aGyiTAj19pZwMepmPnemuvkHs5XirbMQPNJdORTc7uSygx2ewzoyuFVDx7tFK15o6VucdQfkTg1PFV+6G5wfh4ao4nv92aF6o2kghsEO8frkp0OfXiBawLwkfAqFGF2rXBhGdFvzFIDCycpvg7U4OdJpKgONBUYzLDfCGjen8rd49B2tQiAWj9kElX/3MxpteBTwQwVo4M7z396I1zOAQ27WWktge/dDnG2/Q0htDBZJSQvSeZ59OOBrCdhFiynBmCEY2gWVyMYqwlyrn0O5+zMTARYYP/HQ65e9+9vFs5GWCYLFcSKfBwRJghtj+OAX0sh6u5botXpEHTUv2tVeNrqIWR6fr6L7jpmolbbwNcOh7AWSHk7hte2Fvtnb8UOQ1h3GGsma0y1fBIgLVwWAqIM1sFd2TJZ6CpXbySOHGRQyYiUoVYTEfLnod9XFdRIs2s2Seyr6cQ6+hC1QUoAofV49w= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2021 22:11:31.6199 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2540866b-fa01-4264-a58d-08d974a7f1f4 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: CO1NAM11FT063.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5209 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jbrasen@nvidia.com X-Gm-Message-State: ipJ6heEM5JUQkeYDrRjJwZ6vx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631311894; bh=exelQ3VZ3oGsK2YCVYCrWvBbXSth7guFr+2xalvsi0A=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=oW9xPBbZ8uQdl95a7TAC+A9K9vBytf+IGaSGmBMJefWJtxNZeuuATxfjfQ7lhfatdjS ZzpaCS7+YMyaPpiBpuVhzUUjmwH1xG7UtdwoKJr0oK5oWnwAqj+38lB9lPwwII+4iSzzz YILl/iLYuhnWooAQrrdAx4vAPS7u2i3roRc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631311895521100004 Content-Type: text/plain; charset="utf-8" A couple of improvements to improve performance. Add check to return ACCESS_DENIED if already connected Add check to verify superblock magic during supported to reduce start calls Signed-off-by: Jeff Brasen --- Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h | 14 +++++++ Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c | 54 +++++++++++++++++++++------ Features/Ext4Pkg/Ext4Dxe/Superblock.c | 35 +++++++++++++++++ 3 files changed, 92 insertions(+), 11 deletions(-) diff --git a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h b/Features/Ext4Pkg/Ext4Dxe/= Ext4Dxe.h index 64eab455db..a9b932ed52 100644 --- a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h +++ b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h @@ -1117,4 +1117,18 @@ Ext4GetVolumeName ( OUT UINTN *VolNameLen ); =20 +/** + Checks the superblock's magic value. + + @param[in] DiskIo Pointer to the DiskIo. + @param[in] BlockIo Pointer to the BlockIo. + + @returns Whether the partition has a valid EXT4 superblock magic value. +**/ +BOOLEAN +Ext4SuperblockCheckMagic ( + IN EFI_DISK_IO_PROTOCOL *DiskIo, + IN EFI_BLOCK_IO_PROTOCOL *BlockIo + ); + #endif diff --git a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c b/Features/Ext4Pkg/Ext4Dxe/= Ext4Dxe.c index ea2e048d77..d9fbe9ea78 100644 --- a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c +++ b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c @@ -631,7 +631,6 @@ Ext4Unload ( @retval EFI_ACCESS_DENIED The device specified by ControllerHandl= e and RemainingDevicePath is already being ma= naged by a different driver or an application that requires = exclusive access. - Currently not implemented. @retval EFI_UNSUPPORTED The device specified by ControllerHandl= e and RemainingDevicePath is not supported by= the driver specified by This. **/ @@ -643,32 +642,65 @@ Ext4IsBindingSupported ( IN EFI_DEVICE_PATH *RemainingDevicePath OPTIONAL ) { - // Note to self: EFI_OPEN_PROTOCOL_TEST_PROTOCOL lets us not close the - // protocol and ignore the output argument entirely + EFI_STATUS Status; + EFI_DISK_IO_PROTOCOL *DiskIo; + EFI_BLOCK_IO_PROTOCOL *BlockIo; =20 - EFI_STATUS Status; + DiskIo =3D NULL; + BlockIo =3D NULL; =20 + // + // Open the IO Abstraction(s) needed to perform the supported test + // Status =3D gBS->OpenProtocol ( ControllerHandle, &gEfiDiskIoProtocolGuid, - NULL, - BindingProtocol->ImageHandle, + (VOID **) &DiskIo, + BindingProtocol->DriverBindingHandle, ControllerHandle, - EFI_OPEN_PROTOCOL_TEST_PROTOCOL + EFI_OPEN_PROTOCOL_BY_DRIVER ); =20 if (EFI_ERROR (Status)) { return Status; } - + // + // Open the IO Abstraction(s) needed to perform the supported test + // Status =3D gBS->OpenProtocol ( ControllerHandle, &gEfiBlockIoProtocolGuid, - NULL, - BindingProtocol->ImageHandle, + (VOID **) &BlockIo, + BindingProtocol->DriverBindingHandle, ControllerHandle, - EFI_OPEN_PROTOCOL_TEST_PROTOCOL + EFI_OPEN_PROTOCOL_GET_PROTOCOL ); + + if (!EFI_ERROR (Status)) { + if (!Ext4SuperblockCheckMagic (DiskIo, BlockIo)) { + Status =3D EFI_UNSUPPORTED; + } + } + + // + // Close the I/O Abstraction(s) used to perform the supported test + // + if (DiskIo !=3D NULL) { + gBS->CloseProtocol ( + ControllerHandle, + &gEfiDiskIoProtocolGuid, + BindingProtocol->DriverBindingHandle, + ControllerHandle + ); + } + if (BlockIo !=3D NULL) { + gBS->CloseProtocol ( + ControllerHandle, + &gEfiBlockIoProtocolGuid, + BindingProtocol->DriverBindingHandle, + ControllerHandle + ); + } return Status; } =20 diff --git a/Features/Ext4Pkg/Ext4Dxe/Superblock.c b/Features/Ext4Pkg/Ext4D= xe/Superblock.c index c321d8c3d8..0c965415c5 100644 --- a/Features/Ext4Pkg/Ext4Dxe/Superblock.c +++ b/Features/Ext4Pkg/Ext4Dxe/Superblock.c @@ -34,6 +34,41 @@ STATIC CONST UINT32 gSupportedIncompatFeat =3D // this is desired, it's fairly trivial to look for EFI_VOLUME_CORRUPTED // references and add some Ext4SignalCorruption function + function call. =20 +/** + Checks the superblock's magic value. + + @param[in] DiskIo Pointer to the DiskIo. + @param[in] BlockIo Pointer to the BlockIo. + + @returns Whether the partition has a valid EXT4 superblock magic value. +**/ +BOOLEAN +Ext4SuperblockCheckMagic ( + IN EFI_DISK_IO_PROTOCOL *DiskIo, + IN EFI_BLOCK_IO_PROTOCOL *BlockIo + ) +{ + UINT16 Magic; + EFI_STATUS Status; + + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + EXT4_SUPERBLOCK_OFFSET + OFFSET_OF (EXT4_SUPERBLOCK, = s_magic), + sizeof (Magic), + &Magic + ); + if (EFI_ERROR (Status)) { + return FALSE; + } + + if (Magic !=3D EXT4_SIGNATURE) { + return FALSE; + } + + return TRUE; +} + /** Does brief validation of the ext4 superblock. =20 --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#80511): https://edk2.groups.io/g/devel/message/80511 Mute This Topic: https://groups.io/mt/85521568/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 19 03:02:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+80512+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 163131189530361.07117325777676; Fri, 10 Sep 2021 15:11:35 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id CH84YY1788612xTpmR9RzBVB; Fri, 10 Sep 2021 15:11:35 -0700 X-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 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 X-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 X-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 (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+80512+1787277+3901457@groups.io; helo=mail02.groups.io; 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; X-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 X-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 X-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 via groups.io" To: CC: , Jeff Brasen Subject: [edk2-devel] [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> MIME-Version: 1.0 In-Reply-To: References: X-NVConfidentiality: public 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-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-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 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jbrasen@nvidia.com X-Gm-Message-State: CAmiHrjzT1E4xRfAX0AcmWXDx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631311895; bh=NH5sE0REvD+7IVS9GKvVb5nXHgU5Hd67mqQ7kFpjxpw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=SBNAi17cgJ8MG55FNmMyAOm6FQ7bDCdiuwNPdNjkIGPLypA8VF311CVmRzcm9hv5MF5 Ol3SArA3pTgQmvell+V1dCdpIC9jAE7Tv+br6UCVrzomWsEipVnyg1cgvPik5/GecNTMI lbK4qDyh5T0KhaqZX9+0fvDewGd9CLlmg98= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631311897546100011 Content-Type: text/plain; charset="utf-8" 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 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#80512): https://edk2.groups.io/g/devel/message/80512 Mute This Topic: https://groups.io/mt/85521569/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-