]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commit
btrfs/239: call fsync to create tree-log dedicated block group for zoned mode
authorNaohiro Aota <naohiro.aota@wdc.com>
Thu, 21 Sep 2023 09:41:58 +0000 (18:41 +0900)
committerZorro Lang <zlang@kernel.org>
Fri, 22 Sep 2023 18:24:07 +0000 (02:24 +0800)
commit150670eb921647fb02b4faea0d45c394ffe8aef8
tree5d5aa3e957adeba7aa37aa3f6b3ae6a8ab6f770e
parente3121832fc2ba3447662ad8821c99c548aa53de9
btrfs/239: call fsync to create tree-log dedicated block group for zoned mode

Running btrfs/239 on a zoned device often fails with the following error.

  btrfs/239 5s ... - output mismatch (see /host/btrfs/239.out.bad)
      --- tests/btrfs/239.out     2023-09-21 16:56:37.735204924 +0900
      +++ /host/btrfs/239.out.bad  2023-09-21 18:22:45.401433408 +0900
      @@ -1,4 +1,6 @@
       QA output created by 239
      +/testdir/dira still exists
      +/dira does not exists
       File SCRATCH_MNT/testdir/file1 data:
       0000000 ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab
       *
      ...

This happens because "testdir" and "dira" are not logged on the first fsync
(fsync $SCRATCH_MNT/testdir), but are written as a full commit. That
prevents updating the log on "mv" time, leaving them pre-mv state.

The full commit is induced by the creation of a new block group. On the
zoned mode, we use a dedicated block group for tree-log. That block group
is created on-demand or assigned to a metadata block group if there is
none. On the first mount of a file system, we need to create one because
there is only one metadata block group available for the regular
metadata. That creation of a new block group forces tree-log to be a full
commit on that transaction, which prevents logging "testdir" and "dira".

Fix the issue by calling fsync before the first "sync", which creates the
dedicated block group and let the files be properly logged.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/btrfs/239