public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Zorro Lang <zlang@redhat.com>
Cc: David Hildenbrand <david@redhat.com>,
	Christoph Hellwig <hch@lst.de>,
	fstests@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/4] generic: test MADV_POPULATE_READ with IO errors
Date: Sat, 30 Mar 2024 08:31:46 -0700	[thread overview]
Message-ID: <20240330153146.GU6390@frogsfrogsfrogs> (raw)
In-Reply-To: <20240330071200.jmljkdyccwgdzmej@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com>

On Sat, Mar 30, 2024 at 03:12:00PM +0800, Zorro Lang wrote:
> On Tue, Mar 26, 2024 at 07:43:41PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > This is a regression test for "mm/madvise: make
> > MADV_POPULATE_(READ|WRITE) handle VM_FAULT_RETRY properly".
> > 
> > Cc: David Hildenbrand <david@redhat.com>
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > Reviewed-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  tests/generic/1835     |   65 ++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/generic/1835.out |    4 +++
> >  2 files changed, 69 insertions(+)
> >  create mode 100755 tests/generic/1835
> >  create mode 100644 tests/generic/1835.out
> > 
> > 
> > diff --git a/tests/generic/1835 b/tests/generic/1835
> > new file mode 100755
> > index 0000000000..07479ab712
> > --- /dev/null
> > +++ b/tests/generic/1835
> > @@ -0,0 +1,65 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2024 Oracle.  All Rights Reserved.
> > +#
> > +# FS QA Test 1835
> > +#
> > +# This is a regression test for a kernel hang that I saw when creating a memory
> > +# mapping, injecting EIO errors on the block device, and invoking
> > +# MADV_POPULATE_READ on the mapping to fault in the pages.
> > +#
> > +. ./common/preamble
> > +_begin_fstest auto rw
>                          ^^ eio
> 
> > +
> > +# Override the default cleanup function.
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -f $tmp.*
> > +	_dmerror_unmount
> > +	_dmerror_cleanup
> > +}
> > +
> > +# Import common functions.
> > +. ./common/dmerror
> > +
> > +_fixed_by_kernel_commit XXXXXXXXXXXX \
> > +	"mm/madvise: make MADV_POPULATE_(READ|WRITE) handle VM_FAULT_RETRY properly"
> > +
> > +# real QA test starts here
> > +
> > +# Modify as appropriate.
> > +_supported_fs generic
> > +_require_xfs_io_command madvise -R
> > +_require_scratch
> > +_require_dm_target error
> > +_require_command "$TIMEOUT_PROG" "timeout"
> > +
> > +_scratch_mkfs >> $seqres.full 2>&1
> > +_dmerror_init
> > +
> > +filesz=2m
> > +
> > +# Create a file that we'll read, then cycle mount to zap pagecache
> > +_dmerror_mount
> > +$XFS_IO_PROG -f -c "pwrite -S 0x58 0 $filesz" "$SCRATCH_MNT/a" >> $seqres.full
> > +_dmerror_unmount
> > +_dmerror_mount
> > +
> > +# Try to read the file data in a regular fashion just to prove that it works.
> > +echo read with no errors
> > +timeout -s KILL 10s $XFS_IO_PROG -c "mmap -r 0 $filesz" -c "madvise -R 0 $filesz" "$SCRATCH_MNT/a"
> 
> timeout -> $TIMEOUT_PROG
> 
> Others looks good to me, if there's not more review points, I'll merge this
> patch with above changes, after testing done.

Ok.  I don't have any further changes to make to this test, other than
the XXXXX above whenever the fixes get merged.

--D

> Reviewed-by: Zorro Lang <zlang@redhat.com>
> 
> Thanks,
> Zorro
> 
> > +_dmerror_unmount
> > +_dmerror_mount
> > +
> > +# Load file metadata and induce EIO errors on read.  Try to provoke the kernel;
> > +# kill the process after 10s so we can clean up.
> > +stat "$SCRATCH_MNT/a" >> $seqres.full
> > +echo read with IO errors
> > +_dmerror_load_error_table
> > +timeout -s KILL 10s $XFS_IO_PROG -c "mmap -r 0 $filesz" -c "madvise -R 0 $filesz" "$SCRATCH_MNT/a"
> > +_dmerror_load_working_table
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/generic/1835.out b/tests/generic/1835.out
> > new file mode 100644
> > index 0000000000..1b03586e8c
> > --- /dev/null
> > +++ b/tests/generic/1835.out
> > @@ -0,0 +1,4 @@
> > +QA output created by 1835
> > +read with no errors
> > +read with IO errors
> > +madvise: Bad address
> > 
> 
> 

      reply	other threads:[~2024-03-30 15:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27  2:43 [PATCHSET] fstests: random fixes for v2024.02.09 Darrick J. Wong
2024-03-27  2:43 ` [PATCH 1/4] xfs/270: fix rocompat regex Darrick J. Wong
2024-03-27  2:48   ` [PATCH v1.1 " Darrick J. Wong
2024-03-27 11:32     ` Christoph Hellwig
2024-03-27  2:43 ` [PATCH 2/4] xfs/176: fix stupid failure Darrick J. Wong
2024-03-27 11:32   ` Christoph Hellwig
2024-03-27  2:43 ` [PATCH 3/4] generic/{166,167,333,334,671}: actually fill the filesystem with snapshots Darrick J. Wong
2024-03-27 16:59   ` Christoph Hellwig
2024-03-29 23:07     ` Darrick J. Wong
2024-03-30  5:39       ` Christoph Hellwig
2024-03-30  7:14     ` Zorro Lang
2024-03-27  2:43 ` [PATCH 4/4] generic: test MADV_POPULATE_READ with IO errors Darrick J. Wong
2024-03-30  7:12   ` Zorro Lang
2024-03-30 15:31     ` Darrick J. Wong [this message]

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=20240330153146.GU6390@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=david@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=hch@lst.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox