From 47159f48fe3fbde6813b6e4f3edfc35d7a214346 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Tue, 6 Feb 2024 12:45:53 -0500 Subject: [PATCH] LU-10366 test: re-enable sanity test 410 for Ubuntu For older Ubuntu the pr_err() messages in the kinode module was not making it to the dmesg ring buffer due to the default loglevel used in their environment. Now that older verisons of Ubuntu are dropped sanity 410 should pass. Thanks to the work of LU-17096 the kinode modules is in its proper place so sanity 410 should pass. This patch also changes test_410 and kinode to load the module successfully and unload after the test is done. The Lustre spec file is adjusted to accommodate this change. Test-Parameters: trivial Test-Parameters: testlist=sanity env=ONLY=410,ONLY_REPEAT=10 Test-Parameters: testlist=sanity env=ONLY=410,ONLY_REPEAT=10 clientdistro=ubuntu2204 Change-Id: Iac96efe64db721f9d7247a889f6e9bd4c7d45e2a Signed-off-by: James Simmons Signed-off-by: Timothy Day Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/31921 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre.spec.in | 3 +-- lustre/kunit/kinode.c | 12 +++++------- lustre/tests/sanity.sh | 24 +++++++----------------- rpm/kmp-lustre-tests.files | 1 + 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/lustre.spec.in b/lustre.spec.in index df06893..b63f0f6 100644 --- a/lustre.spec.in +++ b/lustre.spec.in @@ -731,8 +731,7 @@ mv $basemodpath/fs/osd_zfs.ko $basemodpath-osd-zfs/fs/osd_zfs.ko mkdir -p $basemodpath-tests/fs mv $basemodpath/fs/llog_test.ko $basemodpath-tests/fs/llog_test.ko mv $basemodpath/fs/obd_test.ko $basemodpath-tests/fs/obd_test.ko -mkdir -p $RPM_BUILD_ROOT%{_libdir}/lustre/tests/kernel/ -mv $basemodpath/fs/kinode.ko $RPM_BUILD_ROOT%{_libdir}/lustre/tests/kernel/ +mv $basemodpath/fs/kinode.ko $basemodpath-tests/fs/kinode.ko %endif %endif diff --git a/lustre/kunit/kinode.c b/lustre/kunit/kinode.c index 2958482..2fea634 100644 --- a/lustre/kunit/kinode.c +++ b/lustre/kunit/kinode.c @@ -110,20 +110,20 @@ static int __init kinode_init(void) if (strlen(fname) < 1) { pr_err(PREFIX " invalid file name '%s'\n", run_id, fname); - goto out; + return -EINVAL; } rc = stat_file(&stbuf1); if (rc) { pr_err(PREFIX " direct stat failed: %d\n", run_id, rc); - goto out; + return -EINVAL; } /* Run the same from a kthread. */ thr = kthread_run(stat_thread, &stbuf2, "kinode_%u", run_id); if (IS_ERR(thr)) { pr_err(PREFIX " Cannot create kthread\n", run_id); - goto out; + return -EINVAL; } /* Wait for the thread to start, then wait for it to @@ -132,7 +132,7 @@ static int __init kinode_init(void) rc = kthread_stop(thr); if (rc) { pr_err(PREFIX " indirect stat failed: %d\n", run_id, rc); - goto out; + return -EINVAL; } if (stbuf1.ino != stbuf2.ino) @@ -143,9 +143,7 @@ static int __init kinode_init(void) pr_err(PREFIX " inode numbers are identical: %llu\n", run_id, stbuf1.ino); -out: - /* Don't load. */ - return -EINVAL; + return 0; } static void __exit kinode_exit(void) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 75b4347..a3f223b 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -112,17 +112,6 @@ elif [ -r /etc/redhat-release ]; then # failure on fio io_uring I/O engine. always_except LU-17289 906 fi -elif [ -r /etc/os-release ]; then - if grep -qi ubuntu /etc/os-release; then - ubuntu_version=$(version_code $(sed -n -e 's/"//g' \ - -e 's/^VERSION=//p' \ - /etc/os-release | - awk '{ print $1 }')) - - if [[ $ubuntu_version -gt $(version_code 16.0.0) ]]; then - always_except LU-10366 410 - fi - fi fi build_test_filter @@ -28389,8 +28378,6 @@ test_410() { [[ $CLIENT_VERSION -lt $(version_code 2.9.59) ]] && skip "Need client version at least 2.9.59" - [ -f $LUSTRE/tests/kernel/kinode.ko ] || - skip "Need MODULES build" # Create a file, and stat it from the kernel local testfile=$DIR/$tfile @@ -28399,15 +28386,18 @@ test_410() local run_id=$RANDOM local my_ino=$(stat --format "%i" $testfile) - # Try to insert the module. This will always fail as the - # module is designed to not be inserted. - insmod $LUSTRE/tests/kernel/kinode.ko run_id=$run_id fname=$testfile \ - &> /dev/null + # Try to insert the module. + load_module kunit/kinode run_id=$run_id fname=$testfile || + error "load_module failed" # Anything but success is a test failure dmesg | grep -q \ "lustre_kinode_$run_id: inode numbers are identical: $my_ino" || error "no inode match" + + # Remove the test module + rmmod -v kinode || + error "rmmod failed (may trigger a failure in a later test)" } run_test 410 "Test inode number returned from kernel thread" diff --git a/rpm/kmp-lustre-tests.files b/rpm/kmp-lustre-tests.files index bc1838e..9deabbc 100644 --- a/rpm/kmp-lustre-tests.files +++ b/rpm/kmp-lustre-tests.files @@ -2,3 +2,4 @@ %dir %{modules_fs_path}/%{lustre_name}-tests/fs %{modules_fs_path}/%{lustre_name}-tests/fs/llog_test.ko %{modules_fs_path}/%{lustre_name}-tests/fs/obd_test.ko +%{modules_fs_path}/%{lustre_name}-tests/fs/kinode.ko -- 1.8.3.1