All of lore.kernel.org
 help / color / mirror / Atom feed
From: "liuyd.fnst@fujitsu.com" <liuyd.fnst@fujitsu.com>
To: "Darrick J. Wong" <djwong@kernel.org>,
	"guaneryu@gmail.com" <guaneryu@gmail.com>,
	"zlang@redhat.com" <zlang@redhat.com>
Cc: "linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>,
	"fstests@vger.kernel.org" <fstests@vger.kernel.org>,
	"guan@eryu.me" <guan@eryu.me>
Subject: Re: [PATCH 1/9] seek_sanity_test: fix allocation unit detection on XFS realtime
Date: Thu, 28 Jul 2022 01:37:08 +0000	[thread overview]
Message-ID: <3f63e720-c252-a836-b700-7a5739312b1b@fujitsu.com> (raw)
In-Reply-To: <165644768327.1045534.10420155448662856970.stgit@magnolia>

Hi, guys.

Recently I hit a regression during test xfstest. Reverting this commit 
could fix that error.

Reproduce steps (only nfs4.2 has this error):
```
# cat local.config

export TEST_DEV=127.0.0.1:/home/nfs/share0

export TEST_DIR=/mnt/test

export SCRATCH_DEV=127.0.0.1:/home/nfs/share1

export SCRATCH_MNT=/mnt/scratch

export FSX_AVOID="-E"

export NFS_MOUNT_OPTIONS="-o rw,relatime,vers=4.2"


# ./check -nfs generic/285

FSTYP         -- nfs

PLATFORM      -- Linux/aarch64 hpe-apollo80-01-n00 
5.14.0-131.el9.aarch64 #1 SMP PREEMPT_DYNAMIC Mon Jul 18 16:13:44 EDT 2022

MKFS_OPTIONS  -- 127.0.0.1:/home/nfs/share1

MOUNT_OPTIONS -- -o rw,relatime,vers=4.2 -o 
context=system_u:object_r:root_t:s0 127.0.0.1:/home/nfs/share1 /mnt/scratch



generic/285 2s ... [failed, exit status 1]- output mismatch (see 
/root/xfstests/results//generic/285.out.bad)

     --- tests/generic/285.out	2022-07-27 21:07:43.160268552 -0400

     +++ /root/xfstests/results//generic/285.out.bad	2022-07-27 
21:31:27.887090532 -0400

     @@ -1 +1,3 @@

      QA output created by 285

     +seek sanity check failed!

     +(see /root/xfstests/results//generic/285.full for details)

     ...

     (Run 'diff -u /root/xfstests/tests/generic/285.out 
/root/xfstests/results//generic/285.out.bad'  to see the entire diff)

Ran: generic/285

Failures: generic/285

Failed 1 of 1 tests


```

Reverting this commit then test pass.
```
# git revert e861a30255c9780425ee5193325d30882fbe7410
# make -j && make install -j
---snip---
# ./check -nfs generic/285

FSTYP         -- nfs

PLATFORM      -- Linux/aarch64 hpe-apollo80-01-n00 
5.14.0-131.el9.aarch64 #1 SMP PREEMPT_DYNAMIC Mon Jul 18 16:13:44 EDT 2022

MKFS_OPTIONS  -- 127.0.0.1:/home/nfs/share1

MOUNT_OPTIONS -- -o rw,relatime,vers=4.2 -o 
context=system_u:object_r:root_t:s0 127.0.0.1:/home/nfs/share1 /mnt/scratch



generic/285 1s ...  1s

Ran: generic/285

Passed all 1 tests

```

On 6/29/22 04:21, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> The seek sanity test tries to figure out a file space allocation unit by
> calling stat and then using an iterative SEEK_DATA method to try to
> detect a smaller blocksize based on SEEK_DATA's consultation of the
> filesystem's internal block mapping.  This was put in (AFAICT) because
> XFS' stat implementation returns max(filesystem blocksize, PAGESIZE) for
> most regular files.
> 
> Unfortunately, for a realtime file with an extent size larger than a
> single filesystem block this doesn't work at all because block mappings
> still work at filesystem block granularity, but allocation units do not.
> To fix this, detect the specific case where st_blksize != PAGE_SIZE and
> trust the fstat results.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>   src/seek_sanity_test.c |   12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/src/seek_sanity_test.c b/src/seek_sanity_test.c
> index 76587b7f..1030d0c5 100644
> --- a/src/seek_sanity_test.c
> +++ b/src/seek_sanity_test.c
> @@ -45,6 +45,7 @@ static int get_io_sizes(int fd)
>   	off_t pos = 0, offset = 1;
>   	struct stat buf;
>   	int shift, ret;
> +	int pagesz = sysconf(_SC_PAGE_SIZE);
>   
>   	ret = fstat(fd, &buf);
>   	if (ret) {
> @@ -53,8 +54,16 @@ static int get_io_sizes(int fd)
>   		return ret;
>   	}
>   
> -	/* st_blksize is typically also the allocation size */
> +	/*
> +	 * st_blksize is typically also the allocation size.  However, XFS
> +	 * rounds this up to the page size, so if the stat blocksize is exactly
> +	 * one page, use this iterative algorithm to see if SEEK_DATA will hint
> +	 * at a more precise answer based on the filesystem's (pre)allocation
> +	 * decisions.
> +	 */
>   	alloc_size = buf.st_blksize;
> +	if (alloc_size != pagesz)
> +		goto done;
>   
>   	/* try to discover the actual alloc size */
>   	while (pos == 0 && offset < alloc_size) {
> @@ -80,6 +89,7 @@ static int get_io_sizes(int fd)
>   	if (!shift)
>   		offset += pos ? 0 : 1;
>   	alloc_size = offset;
> +done:
>   	fprintf(stdout, "Allocation size: %ld\n", alloc_size);
>   	return 0;
>   
> 

  parent reply	other threads:[~2022-07-28  1:38 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 20:21 [PATCHSET 0/9] fstests: random fixes Darrick J. Wong
2022-06-28 20:21 ` [PATCH 1/9] seek_sanity_test: fix allocation unit detection on XFS realtime Darrick J. Wong
2022-06-29  7:41   ` Christoph Hellwig
2022-07-28  1:37   ` liuyd.fnst [this message]
2022-07-28  2:31     ` Darrick J. Wong
2022-07-28  2:37     ` Darrick J. Wong
2022-07-28  3:38       ` liuyd.fnst
2022-07-28  3:54         ` Darrick J. Wong
2022-06-28 20:21 ` [PATCH 2/9] xfs/070: filter new superblock verifier messages Darrick J. Wong
2022-06-29  4:15   ` Dave Chinner
2022-06-29  9:12     ` Zorro Lang
2022-06-29 22:41       ` Darrick J. Wong
2022-06-30  2:18         ` Zorro Lang
2022-06-28 20:21 ` [PATCH 3/9] xfs: test mkfs.xfs sizing of internal logs that Darrick J. Wong
2022-06-29  4:18   ` Dave Chinner
2022-06-29 22:43     ` Darrick J. Wong
2022-06-30  6:37       ` Zorro Lang
2022-06-30 19:32         ` Darrick J. Wong
2022-06-28 20:21 ` [PATCH 4/9] xfs: test xfs_copy doesn't do cached read before libxfs_mount Darrick J. Wong
2022-06-29  4:20   ` Dave Chinner
2022-06-29 22:46     ` Darrick J. Wong
2022-06-30  0:48   ` [PATCH v2.1 " Darrick J. Wong
2022-07-01  1:06     ` Dave Chinner
2022-06-28 20:21 ` [PATCH 5/9] check: document mkfs.xfs reliance on fstests exports Darrick J. Wong
2022-06-29  4:22   ` Dave Chinner
2022-06-28 20:21 ` [PATCH 6/9] xfs/109: handle larger minimum filesystem size Darrick J. Wong
2022-06-29  4:22   ` Dave Chinner
2022-06-28 20:21 ` [PATCH 7/9] xfs/018: fix LARP testing for small block sizes Darrick J. Wong
2022-06-28 20:22 ` [PATCH 8/9] xfs/166: fix golden output failures when multipage folios enabled Darrick J. Wong
2022-06-29  4:23   ` Dave Chinner
2022-06-28 20:22 ` [PATCH 9/9] xfs/547: fix problems with realtime Darrick J. Wong
2022-07-05 14:28 ` [PATCHSET 0/9] fstests: random fixes Zorro Lang
2022-07-05 22:04   ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3f63e720-c252-a836-b700-7a5739312b1b@fujitsu.com \
    --to=liuyd.fnst@fujitsu.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=guaneryu@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zlang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.