]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
ext4: fix potential htree index checksum corruption
authorTheodore Ts'o <tytso@mit.edu>
Thu, 4 Feb 2021 05:05:20 +0000 (00:05 -0500)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Apr 2021 16:31:34 +0000 (18:31 +0200)
commit40fc1b5d52374167df7c8d24bf705b8e968e87c0
tree0389e2e39562910b961405e4025b202869405815
parent75d23e2445230bf2b7f3c3a6beb6efb0359737c4
ext4: fix potential htree index checksum corruption

BugLink: https://bugs.launchpad.net/bugs/1918974
[ Upstream commit b5776e7524afbd4569978ff790864755c438bba7 ]

In the case where we need to do an interior node split, and
immediately afterwards, we are unable to allocate a new directory leaf
block due to ENOSPC, the directory index checksum's will not be filled
in correctly (and indeed, will not be correctly journalled).

This looks like a bug that was introduced when we added largedir
support.  The original code doesn't make any sense (and should have
been caught in code review), but it was hidden because most of the
time, the index node checksum will be set by do_split().  But if
do_split bails out due to ENOSPC, then ext4_handle_dirty_dx_node()
won't get called, and so the directory index checksum field will not
get set, leading to:

EXT4-fs error (device sdb): dx_probe:858: inode #6635543: block 4022: comm nfsd: Directory index failed checksum

Google-Bug-Id: 176345532
Fixes: e08ac99fa2a2 ("ext4: add largedir feature")
Cc: Artem Blagodarenko <artem.blagodarenko@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
fs/ext4/namei.c