Skip to content

Commit 3cdc481

Browse files
fix(ext4.h): remove the rejection of FEATURE_COMPAT_ORPHAN_FILE (#2133)
compat features are safe to ignore and should not block rw mount oigned-off-by: Donjuanplatinum <donplat@barrensea.org>
1 parent 673dcd2 commit 3cdc481

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

kernel/crates/another_ext4/src/ext4/orphan.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,12 @@ fn unsupported_orphan_format(sb: &SuperBlock) -> bool {
4444
unsupported_orphan_features(sb.compatible_features(), sb.read_only_compatible_features())
4545
}
4646

47-
fn unsupported_orphan_features(compatible: u32, read_only_compatible: u32) -> bool {
48-
compatible & SuperBlock::FEATURE_COMPAT_ORPHAN_FILE != 0
49-
|| read_only_compatible & SuperBlock::FEATURE_RO_COMPAT_ORPHAN_PRESENT != 0
47+
fn unsupported_orphan_features(_compatible: u32, read_only_compatible: u32) -> bool {
48+
// FEATURE_COMPAT_ORPHAN_FILE is a *compat* feature: kernels without orphan-file
49+
// support can still mount read-write and simply ignore the dedicated orphan inode.
50+
// Reject only when ORPHAN_PRESENT is set, which means there are actual unrecovered
51+
// orphans in the orphan file that this implementation cannot process.
52+
read_only_compatible & SuperBlock::FEATURE_RO_COMPAT_ORPHAN_PRESENT != 0
5053
}
5154

5255
fn valid_orphan_number<R: LegacyOrphanReader>(reader: &R, inode: InodeId) -> bool {
@@ -395,7 +398,7 @@ mod tests {
395398
#[test]
396399
fn preflight_rejects_each_orphan_file_feature() {
397400
assert!(!unsupported_orphan_features(0, 0));
398-
assert!(unsupported_orphan_features(
401+
assert!(!unsupported_orphan_features(
399402
SuperBlock::FEATURE_COMPAT_ORPHAN_FILE,
400403
0
401404
));

0 commit comments

Comments
 (0)