btrfs: test log replay after directory fsync and moving a child directory
authorFilipe Manana <fdmanana@suse.com>
Wed, 12 May 2021 15:27:35 +0000 (16:27 +0100)
committerEryu Guan <guaneryu@gmail.com>
Sun, 16 May 2021 16:02:42 +0000 (00:02 +0800)
commit33bcdb836aeb9337178d9370e5196bc7910b8d41
tree555b6b4ccb1259010ccc72cc84f6674b92289f0d
parentd80489e7d5881d7c70fefa9a5dc1cd1e15806107
btrfs: test log replay after directory fsync and moving a child directory

Test a particular scenario where we fsync a directory, then move one of
its children directories into another directory and then finally sync the
log trees by fsyncing any other inode. We want to check that after a power
failure we are able to mount the filesystem and that the moved directory
exists only as a child of the directory we moved it into.

This currently fails on a 5.12 kernel (and 5.13-rc1) but is fixed by a
patch with the following subject:

  "btrfs: fix removed dentries still existing after log is synced"

The failure is due to ending up with a directory that has 2 hard links
(two parent directories) as soon as the log replay procedure finishes,
which causes the tree checker to detect the issue and cause the mount
operation to fail with -EIO.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/btrfs/239 [new file with mode: 0755]
tests/btrfs/239.out [new file with mode: 0644]
tests/btrfs/group