OSDN Git Service

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)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 21 Mar 2021 04:03:39 +0000 (00:03 -0400)
commitb7ff91fd030dc9d72ed91b1aab36e445a003af4f
tree7015e62beaf3916d42cec195a5e137ec2e4c7ff6
parentf053cf7aa66cd9d592b0fc967f4d887c2abff1b7
ext4: find old entry again if failed to rename whiteout

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>
fs/ext4/namei.c