Whamcloud - gitweb
LU-18625 llite: use locks_copy_lock API 53/57753/8
authorYang Sheng <ys@whamcloud.com>
Tue, 14 Jan 2025 18:22:01 +0000 (02:22 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 14 Feb 2025 02:58:41 +0000 (02:58 +0000)
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 <ys@whamcloud.com>
Change-Id: I038ab25f51062decf2e7846dfdc98bc81339467a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57753
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/file.c
lustre/tests/parallel-scale-nfs.sh

index 097f3a9..6db7efc 100644 (file)
@@ -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)
index 5e3393d..00a4779 100755 (executable)
@@ -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"