-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
-
3
-
9223372036854775807
Case 1: bad free_blocks accounting
[root@client-el8 ldiskfs]# for i in $(seq 0 2 1024); do dd if=/dev/zero of=testfile bs=4K count=1 seek=$i oflag=direct conv=notrunc; sync ; done ... [root@client-el8 ldiskfs]# debugfs -c -R 'stat testfile' /tmp/ext4 debugfs 1.47.3-wc2 (11-Nov-2025) Inode: 12 Type: regular Mode: 0644 Flags: 0x80000 Generation: 109735300 Version: 0x00000000:00000001 User: 0 Group: 0 Project: 0 Size: 4198400 File ACL: 0 Links: 1 Blockcount: 4120 Fragment: Address: 0 Number: 0 Size: 0 ctime: 0x69c69b9c:637defc0 -- Fri Mar 27 16:00:44 2026 atime: 0x69c69b97:814af470 -- Fri Mar 27 16:00:39 2026 mtime: 0x69c69b9c:637defc0 -- Fri Mar 27 16:00:44 2026 crtime: 0x69c69b97:814af470 -- Fri Mar 27 16:00:39 2026 Size of extra inode fields: 32 EXTENTS: (ETB0):33795, (0):34817, (2):36865, (4):35337,...(ETB0):34306, (680):38652, (682):38655, (684):38658...(1024):39936 [root@client-el8 ~]# umount /mnt/ldiskfs [root@client-el8 ldiskfs]# debugfs -w /tmp/ext4 debugfs 1.47.3-wc2 (11-Nov-2025) debugfs: set_inode_field testfile size 4096 debugfs: set_super_value last_orphan 12 [root@client-el8 ~]# e2fsck -v /tmp/ext4 e2fsck 1.47.3-wc2 (11-Nov-2025) Truncating orphaned inode 12 (uid=0, gid=0, mode=0100644, size=4096) Setting free blocks count to 2554682 (was 2554683) /tmp/ext4: clean, 13/655360 files, 66758/2621440 blocks [root@client-el8 ~]# e2fsck -f /tmp/ext4 e2fsck 1.47.3-wc2 (11-Nov-2025) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information Free blocks count wrong (2554682, counted=2554683). Fix<y>? yes /tmp/ext4: ***** FILE SYSTEM WAS MODIFIED ***** /tmp/ext4: 13/655360 files (0.0% non-contiguous), 66757/2621440 blocks [root@client-el8 ~]# debugfs -c -R 'stat testfile' /tmp/ext4 debugfs 1.47.3-wc2 (11-Nov-2025) Inode: 12 Type: regular Mode: 0644 Flags: 0x80000 Generation: 109735300 Version: 0x00000000:00000001 User: 0 Group: 0 Project: 0 Size: 4096 File ACL: 0 Links: 1 Blockcount: 16 Fragment: Address: 0 Number: 0 Size: 0 ctime: 0x69c69b9c:637defc0 -- Fri Mar 27 16:00:44 2026 atime: 0x69c69b97:814af470 -- Fri Mar 27 16:00:39 2026 mtime: 0x69c69b9c:637defc0 -- Fri Mar 27 16:00:44 2026 crtime: 0x69c69b97:814af470 -- Fri Mar 27 16:00:39 2026 Size of extra inode fields: 32 EXTENTS: (ETB0):33795, (0):34817
The indirect blocks are not counted by e2fsck (free_blocks) when truncated an orphan file.
Case 2: orphan file with ea_inode
[root@client-el8 ldiskfs]# setfattr -n user.lala -v "$(for ((i=0; i < 4096*2; i++)); do echo -n a; done)" toto
[root@client-el8 ldiskfs]# debugfs -c -R 'stat toto' /tmp/ext4
debugfs 1.47.3-wc2 (11-Nov-2025)
Inode: 12 Type: regular Mode: 0644 Flags: 0x80000
Generation: 1419816429 Version: 0x00000000:00000001
User: 0 Group: 0 Project: 0 Size: 0
File ACL: 0
Links: 1 Blockcount: 16
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x69c6925a:c64cda70 -- Fri Mar 27 15:21:14 2026
atime: 0x69c6924d:7b31d064 -- Fri Mar 27 15:21:01 2026
mtime: 0x69c6924d:7b31d064 -- Fri Mar 27 15:21:01 2026
crtime: 0x69c6924d:7b31d064 -- Fri Mar 27 15:21:01 2026
Size of extra inode fields: 32
Extended attributes:
inode <13> user.lala (8192)
EXTENTS:
[root@client-el8 ~]# umount /tmp/ext4
[root@client-el8 ~]# debugfs -w /tmp/ext4
debugfs 1.47.3-wc2 (11-Nov-2025)
debugfs: set_super_value last_orphan 12
debugfs: set_inode_field toto links_count 0
debugfs: unlink toto
[root@client-el8 ~]# e2fsck -f -vvvv /tmp/ext4
e2fsck 1.47.3-wc2 (11-Nov-2025)
Clearing orphaned inode 12 (uid=0, gid=0, mode=0100644, size=0)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Regular filesystem inode 13 has EA_INODE flag set. Clear<y>? yes
Unattached inode 13
Connect to /lost+found<y>? yes
Inode 13 ref count is 2, should be 1. Fix<y>? yes
Pass 5: Checking group summary information
/tmp/ext4: ***** FILE SYSTEM WAS MODIFIED *****
12 inodes used (0.00%, out of 655360)
0 non-contiguous files (0.0%)
0 non-contiguous directories (0.0%)
# of inodes with ind/dind/tind blocks: 0/0/0
Extent depth histogram: 4
66755 blocks used (2.55%, out of 2621440)
0 bad blocks
1 large file
1 regular file
2 directories
0 character device files
0 block device files
0 fifos
0 links
0 symbolic links (0 fast symbolic links)
0 sockets
------------
2 files