]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: treat buffers with write errors as containing valid data
authorZhangXiaoxu <zhangxiaoxu5@huawei.com>
Fri, 23 Aug 2019 03:00:32 +0000 (23:00 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 23 Aug 2019 03:00:32 +0000 (23:00 -0400)
commita445681787064099e042e41eb515dcaf27515a28
tree922d0f204bee33b9dfbfcf63cf1662c401e9e473
parent36a93f9d361218818f1da5aea611b8ee6f70e824
ext4: treat buffers with write errors as containing valid data

I got some errors when I repair an ext4 volume which stacked by an
iscsi target:
    Entry 'test60' in / (2) has deleted/unused inode 73750.  Clear?
It can be reproduced when the network not good enough.

When I debug this I found ext4 will read entry buffer from disk and
the buffer is marked with write_io_error.

If the buffer is marked with write_io_error, it means it already
wroten to journal, and not checked out to disk. IOW, the journal
is newer than the data in disk.
If this journal record 'delete test60', it means the 'test60' still
on the disk metadata.

In this case, if we read the buffer from disk successfully and create
file continue, the new journal record will overwrite the journal
which record 'delete test60', then the entry corruptioned.

So, use the buffer rather than read from disk if the buffer is marked
with write_io_error.

Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/ext4.h
fs/ext4/inode.c