]> git.itanic.dy.fi Git - linux-stable/commit
ext4: find old entry again if failed to rename whiteout
authorzhangyi (F) <yi.zhang@huawei.com>
Wed, 3 Mar 2021 13:17:02 +0000 (21:17 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Mar 2021 09:57:01 +0000 (10:57 +0100)
commit1523c07d6df41c9f051c2aeaa47975345c75fb60
tree610118ad8ed51fd6012500270c33d18d72ffdc0a
parent3db12572117327eec72d38cee972577130d110a1
ext4: find old entry again if failed to rename whiteout

commit b7ff91fd030dc9d72ed91b1aab36e445a003af4f upstream.

If we failed to add new entry on rename whiteout, we cannot reset the
old->de entry directly, because the old->de could have moved from under
us during make indexed dir. So find the old entry again before reset is
needed, otherwise it may corrupt the filesystem as below.

  /dev/sda: Entry '00000001' in ??? (12) has deleted/unused inode 15. CLEARED.
  /dev/sda: Unattached inode 75
  /dev/sda: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.

Fixes: 6b4b8e6b4ad ("ext4: fix bug for rename with RENAME_WHITEOUT")
Cc: stable@vger.kernel.org
Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Link: https://lore.kernel.org/r/20210303131703.330415-1-yi.zhang@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/namei.c