From 461f7e9f892325eb2a92cf025fb925ca1cf141dc Mon Sep 17 00:00:00 2001 From: LoveSy Date: Wed, 24 Jul 2024 10:42:29 +0800 Subject: [PATCH] Use metadata even if it is f2fs --- native/src/core/mount.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/native/src/core/mount.rs b/native/src/core/mount.rs index 7f81453eb..2a1e1b9db 100644 --- a/native/src/core/mount.rs +++ b/native/src/core/mount.rs @@ -201,12 +201,16 @@ pub fn find_preinit_device() -> String { let (_, preinit_info, _) = matched_info.select_nth_unstable_by( 0, |(ap, MountInfo { fs_type: at, .. }), (bp, MountInfo { fs_type: bt, .. })| match ( + ap, + bp, at.as_str() == "ext4", bt.as_str() == "ext4", ) { - // take ext4 over others (f2fs) because f2fs has a kernel bug that causes kernel panic - (true, false) => Less, - (false, true) => Greater, + // metadata is not affected by f2fs kernel bug + (PartId::Metadata, _, _, true) | (_, PartId::Metadata, true, _) => ap.cmp(bp), + // otherwise, take ext4 f2fs because f2fs has a kernel bug that causes kernel panic + (_, _, true, false) => Less, + (_, _, false, true) => Greater, // if both has the same fs type, compare the mount point _ => ap.cmp(bp), },