There was a boolean logic error which, among other things, could cause
an attempt to modify an inode in e2fsck -n mode:
e2fsck 1.47.2 (1-Jan-2025)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
ext2fs_write_inode: Attempt to write to filesystem opened read-only while writing inode 14 in pass4
e2fsck: aborted
Fixes: 849a9e6e133a ("e2fsck: add more checks for ea inode consistency")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* will get attached to lost+found so clear EA_INODE_FL.
* Otherwise this is likely a spuriously set flag so clear it.
*/
- if (*link_counted == 0 ||
+ if (*link_counted == 0 &&
fix_problem(ctx, PR_4_EA_INODE_SPURIOUS_FLAG, &pctx)) {
/* Clear EA_INODE_FL (likely a normal file) */
inode->i_flags &= ~EXT4_EA_INODE_FL;