On Tue, Sep 26, 2023 at 10:51:19AM +0530, Ritesh Harjani wrote: > "Darrick J. Wong" <djwong@xxxxxxxxxx> writes: > > > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > > > Add a regression test for funsharing uncached files to ensure that we > > actually manage the pagecache state correctly. > > > > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> > > --- > > tests/xfs/1936 | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/1936.out | 4 ++ > > 2 files changed, 92 insertions(+) > > create mode 100755 tests/xfs/1936 > > create mode 100644 tests/xfs/1936.out > > > > > > diff --git a/tests/xfs/1936 b/tests/xfs/1936 > > new file mode 100755 > > index 0000000000..e07b8f4796 > > --- /dev/null > > +++ b/tests/xfs/1936 > > @@ -0,0 +1,88 @@ > > +#! /bin/bash > > +# SPDX-License-Identifier: GPL-2.0 > > +# Copyright (c) 2023 Oracle. All Rights Reserved. > > +# > > +# FS QA Test 1936 > > +# > > +# This is a regression test for the kernel commit noted below. The stale > > +# memory exposure can be exploited by creating a file with shared blocks, > > +# evicting the page cache for that file, and then funshareing at least one > > +# memory page's worth of data. iomap will mark the page uptodate and dirty > > +# without ever reading the ondisk contents. > > +# > > +. ./common/preamble > > +_begin_fstest auto quick unshare clone > > + > > +_cleanup() > > +{ > > + cd / > > + rm -r -f $tmp.* $testdir > > +} > > + > > +# real QA test starts here > > + > > +# Import common functions. > > +. ./common/filter > > +. ./common/attr > > We might as well remove above imports if we are not using those in this test. <nod> > > +. ./common/reflink > > + > > +_fixed_by_git_commit kernel XXXXXXXXXXXXX \ > > + "iomap: don't skip reading in !uptodate folios when unsharing a range" > > Once I guess it is merged, we will have the commit-id. Ohh wait, we have > it already right? > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=35d30c9cf12730a1e37053dfde4007c7cc452d1a Oops, yeah, I'll update the tag. > With that the testcode looks good to me. Thanks for finding an easy > reproducer. Please feel free to add - > > Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@xxxxxxxxx> Thanks! > -ritesh