ext4: verify ext4 when the starting block of index and leaf are inconsistent
authorchenlong <chenlongcl.chen@huawei.com>
Mon, 29 Nov 2021 06:21:23 +0000 (14:21 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 5 Dec 2021 13:50:35 +0000 (21:50 +0800)
commit50cd778c0a3daf1e3723dc5800c9e9dc9b42a93f
treec38d9cd508a943ac7fdf17ae07f80497e95cda29
parent23255e2c0842c89a48001b0f75091e088ab04c32
ext4: verify ext4 when the starting block of index and leaf are inconsistent

Insert the extent entry in ext4_ext_insert_extent() (to be inserted at
the beginning of the block). In the stage of updating the starting block
number of the parent index block, an error happened
in ext4_ext_correct_indexes()->ext4_ext_get_access(), which caused the
index update of the parent index node to fail. The ext4_ext_insert_extent()
function exits directly and does not roll back the extent entry of
the leaf block. Eventually, the extent starting block numbers in
the index block and leaf block are inconsistent, triggering bugon.

This is a regression test for three kernel commit:
1. 0f2f87d51aebc (ext4: prevent partial update of the extent blocks)
2. 9c6e071913792 (ext4: check for inconsistent extents between index
   and leaf block)
3. 8dd27fecede55 (ext4: check for out-of-order index extents in
   ext4_valid_extent_entries())

Signed-off-by: Chen Long <chenlongcl.chen@huawei.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/ext4/054 [new file with mode: 0755]
tests/ext4/054.out [new file with mode: 0644]