Skip to main content

Anomaly

Enum Anomaly 

Source
#[non_exhaustive]
pub enum Anomaly { LinkCountTooLow { ino: u32, stored: u16, observed: u32, }, LinkCountTooHigh { ino: u32, stored: u16, observed: u32, }, DanglingEntry { parent_ino: u32, child_ino: u32, observed: u32, }, WrongDotDot { dir_ino: u32, claims: u32, actual_parent: u32, }, BogusEntry { parent_ino: u32, child_ino: u32, name: Vec<u8>, }, BlockGroupFreeCountDrift { group_index: u32, stored_blocks: u32, observed_blocks: u32, stored_inodes: u32, observed_inodes: u32, }, SuperblockFreeCountDrift { stored_blocks: u64, observed_blocks: u64, stored_inodes: u32, observed_inodes: u32, }, DuplicateDirentForDirInode { ino: u32, dirents: Vec<(u32, String)>, }, DirBlockChecksumMismatch { dir_ino: u32, logical_block: u64, htree: bool, }, UnreadableDirectory { ino: u32, reason: String, }, }
Expand description

One problem found by audit. Each variant carries the inode or path needed to act on the finding.

#[non_exhaustive]: the audit learns new findings, and a match on this outside the crate needs a _ arm so a new one does not break it.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

LinkCountTooLow

A directory entry references an inode whose i_links_count is less than the observed reference count. Stored value is too low — fsck would increase it to observed.

Fields

§ino: u32
§stored: u16
§observed: u32
§

LinkCountTooHigh

Inode’s i_links_count is greater than the observed reference count. Stored value is too high — fsck would decrease it.

Fields

§ino: u32
§stored: u16
§observed: u32
§

DanglingEntry

Dangling directory entry: a dir entry points to an inode with i_links_count == 0 or one we couldn’t read.

observed is how many dirents reference child_ino from the audit’s directory walk. For the readable-but-zero-links case the rescue path writes observed into the inode’s i_links_count (it’s the same fix as LinkCountTooLow from stored=0). For the unreadable case we synthesise observed = 0 so the rescue is correctly refused — there’s no safe way to repair an inode we can’t read without orphan-list or /lost+found machinery.

Fields

§parent_ino: u32
§child_ino: u32
§observed: u32
§

WrongDotDot

A directory’s .. entry does not point at its true parent.

Fields

§dir_ino: u32
§claims: u32
§actual_parent: u32
§

BogusEntry

A directory entry inside parent_ino claims its target (child_ino) is a directory, but the target inode’s mode bits are not S_IFDIR. Read failures on the child are surfaced as DanglingEntry from the inodes phase instead. Carrying both inodes lets a repair pass either rewrite the dirent’s file_type byte (when the child is a valid non-dir) or unlink the dirent. Carries the dirent’s name so the repair pass can target the exact record by (parent, name) — necessary when the parent has multiple hardlinks to the same inode and only one of them has the wrong file_type byte. Stored as raw bytes since ext4 dirent names are not required to be UTF-8.

Fields

§parent_ino: u32
§child_ino: u32
§name: Vec<u8>
§

BlockGroupFreeCountDrift

One block group’s free-block / free-inode counters drift from the bitmap reality. Either the bitmap claims fewer free bits than the descriptor says (over-count) or more (under-count). Common after crashes that interrupted bitmap+descriptor pairs mid-write. Repair walks the bitmap, recomputes the truth, and patches the descriptor (incl. checksum when metadata_csum is on).

Fields

§group_index: u32
§stored_blocks: u32
§observed_blocks: u32
§stored_inodes: u32
§observed_inodes: u32
§

SuperblockFreeCountDrift

Superblock free-block / free-inode totals don’t match the sum across all group descriptors’ (post-bitmap) counts. Independent of BlockGroupFreeCountDrift: the per-group descriptors might agree with their bitmaps but the SB total still disagree (e.g. a torn write of just the SB block). Repair recomputes from the bitmaps and writes the SB.

Fields

§stored_blocks: u64
§observed_blocks: u64
§stored_inodes: u32
§observed_inodes: u32
§

DuplicateDirentForDirInode

Multiple directory entries reference the same directory inode. Illegal — directories can have only one parent dirent (plus . and ..). Caused by an inode-allocator bug in early apply_mkdir (fixed) but the on-disk wreckage remains until repair runs.

Fields

§ino: u32
§dirents: Vec<(u32, String)>

Every (parent_ino, name) tuple that references ino. Sorted: (parent_ino asc, name asc) — repair keeps element 0, removes the rest.

§

DirBlockChecksumMismatch

A directory block’s checksum does not match its contents: e2fsck’s “directory passes checks but fails checksum” for a linear block, and “root node fails checksum” / “internal node fails checksum” when htree is set and the block is an htree index.

Only reported on metadata_csum volumes, and only for a block that carries a checksum to check. A repair never restamps a block whose checksum fails unless it is repairing this finding (#344): the repair pass fixes the checksum of a linear block that passes the structural checks, as e2fsck does, and leaves an htree index, which e2fsck rebuilds, reported and untouched.

Fields

§dir_ino: u32
§logical_block: u64
§htree: bool
§

UnreadableDirectory

A directory the walk could not read: its inode does not verify, or its entries cannot be listed (an extent tree that does not parse, a block that cannot be read). Nothing beneath it was examined, so the audit cannot call the volume clean (#445). reason is the error the read failed with.

Not repairable: e2fsck clears such an inode (Inode 2 has corrupt extent header. Clear inode?), which loses everything beneath it, and that is not a decision this repair pass makes.

Fields

§ino: u32
§reason: String

Trait Implementations§

Source§

impl Clone for Anomaly

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Anomaly

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Anomaly

Source§

impl PartialEq for Anomaly

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Anomaly

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.