2023-01-09 05:45:51

by Matthew Wilcox

[permalink] [raw]
Subject: [PATCH 06/11] filemap: Convert filemap_write_and_wait_range() to use errseq

Use the errseq APIs to discover writeback errors instead of
filemap_check_errors(). This gives us more precise information
about whether this writeback generated the error. This will no
longer clear errors, so they will be visible to other users, which
is what we want. Take this opportunity to de-indent
filemap_write_and_wait_range().

Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
---
mm/filemap.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 48daedc224d9..c72b2e1140d7 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -659,26 +659,27 @@ EXPORT_SYMBOL_GPL(filemap_range_has_writeback);
int filemap_write_and_wait_range(struct address_space *mapping,
loff_t lstart, loff_t lend)
{
- int err = 0, err2;
+ int err;
+ errseq_t since;

if (lend < lstart)
return 0;
+ if (!mapping_needs_writeback(mapping))
+ return 0;

- if (mapping_needs_writeback(mapping)) {
- err = __filemap_fdatawrite_range(mapping, lstart, lend,
- WB_SYNC_ALL);
- /*
- * Even if the above returned error, the pages may be
- * written partially (e.g. -ENOSPC), so we wait for it.
- * But the -EIO is special case, it may indicate the worst
- * thing (e.g. bug) happened, so we avoid waiting for it.
- */
- if (err != -EIO)
- __filemap_fdatawait_range(mapping, lstart, lend);
- }
- err2 = filemap_check_errors(mapping);
+ since = filemap_sample_wb_err(mapping);
+ err = __filemap_fdatawrite_range(mapping, lstart, lend, WB_SYNC_ALL);
+ /*
+ * Even if the above returned an error, the pages may be written
+ * partially (e.g. -ENOSPC), so we wait for it. But the -EIO
+ * is a special case, it may indicate the worst thing (e.g. bug)
+ * happened, so we avoid waiting for it.
+ */
+ if (err != -EIO)
+ __filemap_fdatawait_range(mapping, lstart, lend);
if (!err)
- err = err2;
+ err = filemap_check_wb_err(mapping, since);
+
return err;
}
EXPORT_SYMBOL(filemap_write_and_wait_range);
--
2.35.1


2023-01-17 03:34:03

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 06/11] filemap: Convert filemap_write_and_wait_range() to use errseq


Greeting,

FYI, we noticed xfstests.generic.475.fail due to commit (built with gcc-11):

commit: f6a6a1bcc3903e3bb50ac4d96e27c56007065646 ("[PATCH 06/11] filemap: Convert filemap_write_and_wait_range() to use errseq")
url: https://github.com/intel-lab-lkp/linux/commits/Matthew-Wilcox-Oracle/memory-failure-Remove-comment-referencing-AS_EIO/20230109-132009
base: https://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs.git dev-test
patch link: https://lore.kernel.org/all/[email protected]/
patch subject: [PATCH 06/11] filemap: Convert filemap_write_and_wait_range() to use errseq

in testcase: xfstests
version: xfstests-x86_64-fb6575e-1_20230116
with following parameters:

disk: 4HDD
fs: ext4
test: generic-group-23

test-description: xfstests is a regression test suite for xfs and other files ystems.
test-url: git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git


on test machine: 4 threads Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz (Skylake) with 32G memory

caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):


If you fix the issue, kindly add following tag
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-lkp/[email protected]


generic/475 [failed, exit status 1]- output mismatch (see /lkp/benchmarks/xfstests/results//generic/475.out.bad)
--- tests/generic/475.out 2023-01-16 16:39:10.000000000 +0000
+++ /lkp/benchmarks/xfstests/results//generic/475.out.bad 2023-01-17 02:04:43.317885414 +0000
@@ -1,2 +1,6 @@
QA output created by 475
Silence is golden.
+mount: /fs/scratch: can't read superblock on /dev/mapper/error-test.
+mount failed
+(see /lkp/benchmarks/xfstests/results//generic/475.full for details)
+umount: /fs/scratch: not mounted.
...
(Run 'diff -u /lkp/benchmarks/xfstests/tests/generic/475.out /lkp/benchmarks/xfstests/results//generic/475.out.bad' to see the entire diff)


To reproduce:

git clone https://github.com/intel/lkp-tests.git
cd lkp-tests
sudo bin/lkp install job.yaml # job file is attached in this email
bin/lkp split-job --compatible job.yaml # generate the yaml file for lkp run
sudo bin/lkp run generated-yaml-file

# if come across any failure that blocks the test,
# please remove ~/.lkp and /lkp dir to run from a clean state.



--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests



Attachments:
(No filename) (2.51 kB)
config-6.2.0-rc2-00068-gf6a6a1bcc390 (174.58 kB)
job-script (5.87 kB)
dmesg.xz (43.61 kB)
xfstests (2.72 kB)
job.yaml (4.75 kB)
reproduce (905.00 B)
Download all attachments