generic: add test for fsync after renaming hard links of same file

Test that if we have a file with 2 (or more) hard links in the same
parent directory, rename of the hard links, rename one of the other
hard links to the old name of the hard link we renamed before,
create a new file in the same parent directory with the old name of
second hard link we renamed, fsync fsync this new file and power
fail, we will be able to mount again the filesystem and the new file
and all hard links exist.

This test is motivated by a bug found in btrfs, where mounting the
filesystem after the power failure resulted in failure with an errno
value of EEXIST, which is fixed by a patch for the linux kernel
titled:

  "Btrfs: fix mount failure after fsync due to hard link recreation"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Filipe Manana
2018-07-19 19:02:20 +01:00
committed by Eryu Guan
parent b29b8b077e
commit b19c447027
3 changed files with 91 additions and 0 deletions
+1
View File
@@ -504,3 +504,4 @@
499 auto quick rw collapse zero
500 auto thin trim
501 auto quick clone log
502 auto quick log