linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Ritesh Harjani <ritesh.list@gmail.com>
Cc: fstests <fstests@vger.kernel.org>,
	linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	"Darrick J . Wong" <djwong@kernel.org>,
	Ritesh Harjani <riteshh@linux.ibm.com>
Subject: Re: [PATCHv3 1/4] generic/468: Add another falloc test entry
Date: Mon, 4 Apr 2022 09:28:23 +1000	[thread overview]
Message-ID: <20220403232823.GS1609613@dread.disaster.area> (raw)
In-Reply-To: <75f4c780e8402a8f993cb987e85a31e4895f13de.1648730443.git.ritesh.list@gmail.com>

On Thu, Mar 31, 2022 at 06:24:20PM +0530, Ritesh Harjani wrote:
> From: Ritesh Harjani <riteshh@linux.ibm.com>
> 
> Add another falloc test entry which could hit a kernel bug
> with ext4 fast_commit feature w/o below kernel commit [1].
> 
> <log>
> [  410.888496][ T2743] BUG: KASAN: use-after-free in ext4_mb_mark_bb+0x26a/0x6c0
> [  410.890432][ T2743] Read of size 8 at addr ffff888171886000 by task mount/2743
> 
> This happens when falloc -k size is huge which spans across more than
> 1 flex block group in ext4. This causes a bug in fast_commit replay
> code which is fixed by kernel commit at [1].
> 
> [1]: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git/commit/?h=dev&id=bfdc502a4a4c058bf4cbb1df0c297761d528f54d
> 
> Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
> ---
>  tests/generic/468     | 8 ++++++++
>  tests/generic/468.out | 2 ++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/tests/generic/468 b/tests/generic/468
> index 95752d3b..5e73cff9 100755
> --- a/tests/generic/468
> +++ b/tests/generic/468
> @@ -34,6 +34,13 @@ _scratch_mkfs >/dev/null 2>&1
>  _require_metadata_journaling $SCRATCH_DEV
>  _scratch_mount
>  
> +# blocksize and fact are used in the last case of the fsync/fdatasync test.
> +# This is mainly trying to test recovery operation in case where the data
> +# blocks written, exceeds the default flex group size (32768*4096*16) in ext4.
> +blocks=32768
> +blocksize=4096

Block size can change based on mkfs parameters. You should extract
this dynamically from the filesystem the test is being run on.

> +fact=18

What is "fact" supposed to mean?

Indeed, wouldn't this simply be better as something like:

larger_than_ext4_fg_size=$((32768 * $blksize * 18))

And then

>  testfile=$SCRATCH_MNT/testfile
>  
>  # check inode metadata after shutdown
> @@ -85,6 +92,7 @@ for i in fsync fdatasync; do
>  	test_falloc $i "-k " 1024
>  	test_falloc $i "-k " 4096
>  	test_falloc $i "-k " 104857600
> +	test_falloc $i "-k " $(($blocks*$blocksize*$fact))

	test_falloc $i "-k " $larger_than_ext4_fg_size

And just scrub all the sizes from the golden output?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2022-04-03 23:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 12:54 [PATCHv3 0/4] generic: Add some tests around journal replay/recoveryloop Ritesh Harjani
2022-03-31 12:54 ` [PATCHv3 1/4] generic/468: Add another falloc test entry Ritesh Harjani
2022-04-03 23:28   ` Dave Chinner [this message]
2022-04-05 11:06     ` Ritesh Harjani
2022-04-05 22:00       ` Theodore Ts'o
2022-04-06 11:52         ` Ritesh Harjani
2022-04-06  4:05       ` Dave Chinner
2022-04-06 11:56         ` Ritesh Harjani
2022-03-31 12:54 ` [PATCHv3 2/4] common/punch: Add block_size argument to _filter_fiemap_** Ritesh Harjani
2022-03-31 12:54 ` [PATCHv3 3/4] generic/678: Add a new shutdown recovery test Ritesh Harjani
2022-04-03 23:38   ` Dave Chinner
2022-04-05 10:57     ` Ritesh Harjani
2022-03-31 12:54 ` [PATCHv3 4/4] generic/679: Add a test to check unwritten extents tracking Ritesh Harjani
2022-04-03 23:43   ` Dave Chinner
2022-04-05 10:56     ` Ritesh Harjani
2022-03-31 14:59 ` [PATCHv3 0/4] generic: Add some tests around journal replay/recoveryloop Zorro Lang
2022-03-31 16:19   ` Ritesh Harjani
2022-03-31 16:53     ` Ritesh Harjani
2022-04-01  5:30       ` Zorro Lang
2022-04-01  5:55         ` Ojaswin Mujoo
2022-04-01 17:04         ` Darrick J. Wong
2022-04-02  3:40           ` Zorro Lang

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=20220403232823.GS1609613@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=ritesh.list@gmail.com \
    --cc=riteshh@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).