Files
apfstests/tests/generic
Filipe Manana 1bea79d6c1 generic: fsync files with multiple links
Test that when we have a file with multiple hard links belonging to
different parent directories, if we remove one of those links, fsync the
file using one of its other links (that has a parent directory different
from the one we removed a link from), power fail and then replay the
fsync log/journal, the hard link we removed is not available anymore and
all the filesystem metadata is in a consistent state.

This test is motivated by an issue found in btrfs, where the test fails
with:

  generic/107 2s ... - output mismatch (see .../results/generic/107.out.bad)
    --- tests/generic/107.out	2015-08-04 09:47:46.922131256 +0100
    +++ /home/fdmanana/git/hub/xfstests/results//generic/107.out.bad
    @@ -1,3 +1,5 @@
     QA output created by 107
     Entries in testdir:
     foo2
    +foo3
    +rmdir: failed to remove '/home/fdmanana/btrfs-tests/scratch_1/testdir': Directory not empty
    ...
    (Run 'diff -u tests/generic/107.out .../generic/107.out.bad'  to see the entire diff)
  _check_btrfs_filesystem: filesystem on /dev/sdc is inconsistent (see .../generic/107.full)
  _check_dmesg: something found in dmesg (see .../generic/107.dmesg)

  $ cat /home/fdmanana/git/hub/xfstests/results//generic/107.full
  _check_btrfs_filesystem: filesystem on /dev/sdc is inconsistent
  *** fsck.btrfs output ***
  checking extents
  checking free space cache
  checking fs roots
  root 5 inode 257 errors 200, dir isize wrong
	unresolved ref dir 257 index 3 namelen 4 name foo3 filetype 1 \
          errors 5, no dir item, no inode ref

  $ cat /home/fdmanana/git/hub/xfstests/results//generic/107.dmesg
  (...)
  [188897.707311] BTRFS info (device dm-0): failed to delete reference to \
    foo3, inode 258 parent 257
  [188897.711345] ------------[ cut here ]------------
  [188897.713369] WARNING: CPU: 10 PID: 19452 at fs/btrfs/inode.c:3956 \
    __btrfs_unlink_inode+0x182/0x35a [btrfs]()
  [188897.717661] BTRFS: Transaction aborted (error -2)
  (...)
  [188897.747898] Call Trace:
  [188897.748519]  [<ffffffff8145f077>] dump_stack+0x4f/0x7b
  [188897.749602]  [<ffffffff81095de5>] ? console_unlock+0x356/0x3a2
  [188897.750682]  [<ffffffff8104b3b0>] warn_slowpath_common+0xa1/0xbb
  [188897.751936]  [<ffffffffa04c5d09>] ? __btrfs_unlink_inode+0x182/0x35a [btrfs]
  [188897.753485]  [<ffffffff8104b410>] warn_slowpath_fmt+0x46/0x48
  [188897.754781]  [<ffffffffa04c5d09>] __btrfs_unlink_inode+0x182/0x35a [btrfs]
  [188897.756295]  [<ffffffffa04c6e8f>] btrfs_unlink_inode+0x1e/0x40 [btrfs]
  [188897.757692]  [<ffffffffa04c6f11>] btrfs_unlink+0x60/0x9b [btrfs]
  [188897.758978]  [<ffffffff8116fb48>] vfs_unlink+0x9c/0xed
  [188897.760151]  [<ffffffff81173481>] do_unlinkat+0x12b/0x1fb
  [188897.761354]  [<ffffffff81253855>] ? lockdep_sys_exit_thunk+0x12/0x14
  [188897.762692]  [<ffffffff81174056>] SyS_unlinkat+0x29/0x2b
  [188897.763741]  [<ffffffff81465197>] system_call_fastpath+0x12/0x6f
  [188897.764894] ---[ end trace bbfddacb7aaada8c ]---
  [188897.765801] BTRFS warning (device dm-0): __btrfs_unlink_inode:3956: \
    Aborting unused transaction(No such entry).

Tested against ext3/4, xfs, reiserfs and f2fs too, and all these
filesystems currently pass this test (on a 4.1 linux kernel at least).

The btrfs issue is fixed by the linux kernel patch titled:
"Btrfs: fix stale dir entries after removing a link and fsync".

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-09-21 11:04:25 +10:00
..
2014-11-10 18:06:23 +11:00
2013-04-04 06:55:21 -05:00
2014-04-11 10:18:20 +10:00
2014-04-14 10:35:27 +10:00
2014-04-14 11:19:23 +10:00
2014-04-14 10:37:32 +10:00
2014-04-28 10:55:12 +10:00
2015-03-18 14:57:49 +11:00
2014-05-27 12:07:17 +10:00
2014-06-18 09:31:38 +10:00
2014-12-12 11:26:15 +11:00
2014-12-12 11:26:15 +11:00
2014-12-12 11:26:15 +11:00
2014-09-29 12:58:24 +10:00
2014-12-12 11:26:15 +11:00
2014-12-12 11:26:15 +11:00
2014-09-29 13:26:32 +10:00
2014-10-14 17:40:34 +11:00
2014-10-14 17:40:34 +11:00
2015-09-21 11:03:22 +10:00
2015-01-21 15:58:23 +11:00
2013-04-04 06:55:21 -05:00
2015-02-25 15:32:47 +11:00
2015-02-25 15:32:47 +11:00
2015-02-25 15:33:06 +11:00
2015-02-25 15:33:19 +11:00
2015-02-25 15:33:19 +11:00
2013-04-04 06:55:21 -05:00
2015-02-25 15:33:55 +11:00
2013-04-04 06:55:21 -05:00
2015-03-18 14:58:51 +11:00
2015-03-18 14:58:51 +11:00
2015-04-01 11:29:16 +11:00
2013-04-04 06:55:21 -05:00
2015-04-02 09:41:15 +11:00
2015-05-04 22:55:33 +10:00
2015-05-26 12:51:57 +10:00
2015-08-04 14:10:49 +10:00
2015-08-04 14:10:49 +10:00
2015-08-04 14:10:49 +10:00
2015-08-04 14:10:49 +10:00
2013-04-04 06:55:21 -05:00
2015-09-21 11:04:25 +10:00
2013-04-04 06:55:21 -05:00
2013-12-03 10:29:26 +11:00
2013-12-03 10:29:26 +11:00
2013-12-03 10:29:26 +11:00
2015-05-26 12:51:57 +10:00
2013-12-03 10:29:26 +11:00
2014-11-10 18:06:23 +11:00
2014-09-29 13:07:26 +10:00
2013-04-04 06:55:21 -05:00
2014-08-13 11:20:59 +10:00
2014-04-22 10:46:49 +10:00
2013-04-04 06:55:21 -05:00
2014-10-14 17:07:52 +11:00
2014-12-16 10:53:57 +11:00
2014-12-16 10:53:57 +11:00
2014-10-14 17:07:52 +11:00
2014-12-16 10:53:57 +11:00
2014-11-10 18:06:23 +11:00
2014-09-29 13:07:26 +10:00
2014-10-14 17:07:52 +11:00
2014-12-12 10:55:24 +11:00
2014-01-20 12:47:56 +11:00
2014-12-12 11:26:15 +11:00
2014-12-16 10:53:57 +11:00
2014-08-13 11:19:33 +10:00
2015-09-21 11:04:25 +10:00