From a6797aa3de956115ed466a11c07285b18a003cab Mon Sep 17 00:00:00 2001 From: Yang Sheng Date: Wed, 15 Jan 2025 02:22:01 +0800 Subject: [PATCH] LU-18625 llite: use locks_copy_lock API The RHEL8.[4-7] operates the lockowner ref-count in fl_copy_lock, So use locks_copy_lock to expand the fixing scope. Also skip the test case if work without fix patch in interop enviroment. Fixes: fb3c3d2052 ("LU-17692 llite: flock work with lockd") Signed-off-by: Yang Sheng Change-Id: I038ab25f51062decf2e7846dfdc98bc81339467a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57753 Tested-by: jenkins Tested-by: Oleg Drokin Reviewed-by: Oleg Drokin --- lustre/llite/file.c | 6 ++++-- lustre/tests/parallel-scale-nfs.sh | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 097f3a9..6db7efc 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -5653,12 +5653,14 @@ out: if (rc == 0 && (flags & LDLM_FL_TEST_LOCK) && file_lock->C_FLC_TYPE != F_UNLCK) { - struct file_lock flbuf; + struct file_lock flbuf = { .fl_ops = NULL, }; + /* The parallel-scale-nfs test_2 checks this line */ + char __maybe_unused *str = "Invoke locks_copy_lock for NFSv3"; /* Take a extra reference for lockowner while * working with lockd. */ - locks_copy_conflock(&flbuf, file_lock); + locks_copy_lock(&flbuf, file_lock); } if (!rc) diff --git a/lustre/tests/parallel-scale-nfs.sh b/lustre/tests/parallel-scale-nfs.sh index 5e3393d..00a4779 100755 --- a/lustre/tests/parallel-scale-nfs.sh +++ b/lustre/tests/parallel-scale-nfs.sh @@ -143,11 +143,36 @@ test_1() { } run_test 1 "test copy with attributes" +mod_strings() +{ + local node=$1 + local mod=$2 + + local args=($(do_node $node "cat /sys/module/$mod/sections/__ksymtab /sys/module/$mod/coresize")) + + [[ $((args[1])) > 0 ]] || return + + local min=$((0x7fffffffffffffff)) + while read line; do + local as=($line) + + val=$((${args[0]}-${as[2]})) + (($val > 0 && $min > $val)) && ofs=${as[1]} && min=$val + done <<< $(do_node $node "readelf -l /proc/kcore" | grep LOAD) + + do_node $node "od --strings -A none -j $((ofs+min)) -N ${args[1]} /proc/kcore" +} + test_2() { local mp1file=$TESTDIR/file1 local tmpdir=$(mktemp -d /tmp/nfs-XXXXXX) local mp2file=$tmpdir/${mp1file#$NFS_CLIMNTPT} + # Skip without fixing patch + mod_strings $LUSTRE_CLIENT_NFSSRV lustre | + grep 'Invoke locks_copy_lock for NFSv3' || + skip "NFSv3 server missing locks_copy_lock()" + mount -v -t nfs -o nfsvers=$NFSVERSION,async \ $LUSTRE_CLIENT_NFSSRV:$NFS_SRVMNTPT $tmpdir ||\ error "Nfs 2nd mount($tmpdir) error" -- 1.8.3.1