2022-03-17 05:28:08

by Jiapeng Chong

[permalink] [raw]
Subject: [PATCH] xfs: Fix missing error code in xfs_reflink_end_cow_extent()

The error code is missing in this code scenario, add the error code
'-EINVAL' to the return value 'error'.

Eliminate the follow smatch warning:

fs/xfs/xfs_reflink.c:634 xfs_reflink_end_cow_extent() warn: missing
error code 'error'.

Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Jiapeng Chong <[email protected]>
---
fs/xfs/xfs_reflink.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 54e68e5693fd..7265f8850f65 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -631,6 +631,7 @@ xfs_reflink_end_cow_extent(
if (!xfs_iext_lookup_extent_before(ip, ifp, end_fsb, &icur, &got) ||
got.br_startoff + got.br_blockcount <= offset_fsb) {
*end_fsb = offset_fsb;
+ error = -EINVAL;
goto out_cancel;
}

--
2.20.1.7.g153144c


2022-03-21 23:24:49

by kernel test robot

[permalink] [raw]
Subject: [xfs] f04c30c1aa: xfstests.xfs.239.fail



Greeting,

FYI, we noticed the following commit (built with gcc-9):

commit: f04c30c1aa9fedd866f875d02a6d8e7bdcf7033a ("[PATCH] xfs: Fix missing error code in xfs_reflink_end_cow_extent()")
url: https://github.com/0day-ci/linux/commits/Jiapeng-Chong/xfs-Fix-missing-error-code-in-xfs_reflink_end_cow_extent/20220317-094049
base: https://git.kernel.org/cgit/fs/xfs/xfs-linux.git for-next
patch link: https://lore.kernel.org/linux-xfs/[email protected]

in testcase: xfstests
version: xfstests-x86_64-1de1db8-1_20220217
with following parameters:

disk: 4HDD
fs: xfs
test: xfs-reflink-11
ucode: 0x28

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: 8 threads 1 sockets Intel(R) Core(TM) i7-4790 v3 @ 3.60GHz with 6G 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]>

2022-03-18 14:11:54 export TEST_DIR=/fs/sda1
2022-03-18 14:11:54 export TEST_DEV=/dev/sda1
2022-03-18 14:11:54 export FSTYP=xfs
2022-03-18 14:11:54 export SCRATCH_MNT=/fs/scratch
2022-03-18 14:11:54 mkdir /fs/scratch -p
2022-03-18 14:11:54 export SCRATCH_DEV=/dev/sda4
2022-03-18 14:11:54 export SCRATCH_LOGDEV=/dev/sda2
2022-03-18 14:11:54 export SCRATCH_XFS_LIST_METADATA_FIELDS=u3.sfdir3.hdr.parent.i4
2022-03-18 14:11:54 export SCRATCH_XFS_LIST_FUZZ_VERBS=random
2022-03-18 14:11:54 export MKFS_OPTIONS=-mreflink=1
2022-03-18 14:11:54 sed "s:^:xfs/:" //lkp/benchmarks/xfstests/tests/xfs-reflink-11
2022-03-18 14:11:54 ./check xfs/221 xfs/223 xfs/224 xfs/225 xfs/226 xfs/228 xfs/230 xfs/231 xfs/232 xfs/237 xfs/239
FSTYP -- xfs (debug)
PLATFORM -- Linux/x86_64 lkp-hsw-d02 5.17.0-rc6-00009-gf04c30c1aa9f #1 SMP Fri Mar 18 13:29:39 CST 2022
MKFS_OPTIONS -- -f -mreflink=1 /dev/sda4
MOUNT_OPTIONS -- /dev/sda4 /fs/scratch

xfs/221 4s
xfs/223 6s
xfs/224 6s
xfs/225 4s
xfs/226 5s
xfs/228 6s
xfs/230 6s
xfs/231 8s
xfs/232 8s
xfs/237 5s
xfs/239 - output mismatch (see /lkp/benchmarks/xfstests/results//xfs/239.out.bad)
--- tests/xfs/239.out 2022-02-17 11:55:00.000000000 +0000
+++ /lkp/benchmarks/xfstests/results//xfs/239.out.bad 2022-03-18 14:13:00.157358863 +0000
@@ -5,6 +5,7 @@
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-239/file1
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-239/file2
CoW and unmount
+write missed bytes expect 8388608 got 0
Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-239/file1
7a4d22297e80ff3c92cb1b3e4566d234 SCRATCH_MNT/test-239/file2
...
(Run 'diff -u /lkp/benchmarks/xfstests/tests/xfs/239.out /lkp/benchmarks/xfstests/results//xfs/239.out.bad' to see the entire diff)
Ran: xfs/221 xfs/223 xfs/224 xfs/225 xfs/226 xfs/228 xfs/230 xfs/231 xfs/232 xfs/237 xfs/239
Failures: xfs/239
Failed 1 of 11 tests




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://01.org/lkp



Attachments:
(No filename) (3.53 kB)
config-5.17.0-rc6-00009-gf04c30c1aa9f (168.18 kB)
job-script (5.88 kB)
dmesg.xz (26.84 kB)
xfstests (1.94 kB)
job.yaml (4.79 kB)
reproduce (996.00 B)
Download all attachments