generic: add test for fsync after renaming file

Test that if we rename a file, create a new file that has the old name
of the other file and is a child of the same parent directory, fsync the
new inode, power fail and mount the filesystem, we do not lose the first
file and that file has the name it was renamed to.

This test is motivated by an issue found in btrfs which is fixed by the
following patch for the linux kernel:

  "Btrfs: fix file loss caused by fsync after rename and new inode"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
Filipe Manana
2016-04-05 11:47:55 +10:00
committed by Dave Chinner
parent 5b13255306
commit f02fe94911
3 changed files with 106 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
QA output created by 342
wrote 16384/16384 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 16384/16384 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
File digests before log replay:
9e5d56a1f9b2c93589f9d55480f971a1 SCRATCH_MNT/a/foo
48c940ba3b8671d3d6ea74e4ccad8ca3 SCRATCH_MNT/a/bar
Directory a/ contents after log replay:
SCRATCH_MNT/a:
bar
foo
File digests after log replay:
9e5d56a1f9b2c93589f9d55480f971a1 SCRATCH_MNT/a/foo
48c940ba3b8671d3d6ea74e4ccad8ca3 SCRATCH_MNT/a/bar