Whamcloud - gitweb
LU-17613 tests: explicit check for eviction with dmesg parse
authorVladimir Saveliev <vladimir.saveliev@hpe.com>
Tue, 30 Jul 2024 15:21:43 +0000 (18:21 +0300)
committerOleg Drokin <green@linuxhacker.ru>
Tue, 7 Jan 2025 02:18:08 +0000 (21:18 -0500)
client_evicted() used to check for client eviction based on result of
lfs df. When it returned any error but EOPNOTSUPP - that was taken as
"client was evicted".

When glibc's realpath() changed to not call stat()
(see for ref
  stdlib: Sync canonicalize with gnulib [BZ #10635] [BZ #26592] [BZ
  ..
  - Realpath mishandles EOVERFLOW; stat not needed anyway (BZ#24970).
)
'lfs df' started to return EOPNOTSUPP from lfs_df(). client_evicted()
was changed, now any non-zero return is taken as client was evicted.

Check for "This client was evicted" in dmesg output to make sure that
eviction happened.

Add a comment in ptlrpc_import_recovery_state_machine() to make it
clear that this specific error message is used by the test code. Avoid
ratelimiting for the message.

Lustre-change: https://review.whamcloud.com/54299
Lustre-commit: ab5a2b63fb90b75ef07d25b347423e2db05286ef

Fixes: a5a9ded43b ("LU-16916 tests: fix client_evicted() not to ignore EOPNOTSUPP")
Test-Parameters: trivial testlist=replay-vbr,recovery-small
HPE-bug-id: LUS-11742
Signed-off-by: Vladimir Saveliev <vladimir.saveliev@hpe.com>
Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: I10ef99d23d630164bfdf167e54e2f177e9b85598

lustre/ptlrpc/import.c
lustre/tests/replay-dual.sh
lustre/tests/test-framework.sh

index 565ba18..94fa210 100644 (file)
@@ -1562,11 +1562,9 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp)
                 /* Don't care about MGC eviction */
                 if (strcmp(imp->imp_obd->obd_type->typ_name,
                            LUSTRE_MGC_NAME) != 0) {
-                       LCONSOLE_ERROR_MSG(0x167, "%s: This client was evicted "
-                                          "by %.*s; in progress operations "
-                                          "using this service will fail.\n",
-                                          imp->imp_obd->obd_name, target_len,
-                                          target_start);
+                       /* below message checked in test-framework client_evicted() */
+                       LCONSOLE(D_ERROR, "%s: This client was evicted by %.*s; in progress operations using this service will fail.\n",
+                                imp->imp_obd->obd_name, target_len, target_start);
                        LASSERTF(!obd_lbug_on_eviction, "LBUG upon eviction\n");
                 }
                 CDEBUG(D_HA, "evicted from %s@%s; invalidating\n",
index 81ec68d..7f87a83 100755 (executable)
@@ -1227,8 +1227,7 @@ test_32() {
 
        $LFS df $DIR
 
-       local testid=$(echo $TESTNAME | tr '_' ' ')
-       dmesg | tac | sed "/$testid/,$ d" | grep "This client was evicted" &&
+       client_evicted $CLIENT1 &&
                error "client got evicted due to aborted recovery"
        return 0
 }
index a8cf956..69e4309 100755 (executable)
@@ -3629,9 +3629,17 @@ client_up() {
        lfs_df_check $1
 }
 
+# usage: client_evicted client [evictor, mds1 by default]
+# return true if \a client was evicted by \a evictor in current test
 client_evicted() {
-       sleep 1
-       ! _lfs_df_check $1
+       local testid=$(echo $TESTNAME | tr '_' ' ')
+       local client=$1
+       local facet=${2:-mds1}
+       local dev=$(facet_svc $facet)
+
+       client_up $client
+       $PDSH $client "dmesg | tac | sed \"/$testid/,$ d\"" |
+               grep -q "client was evicted by ${dev}"
 }
 
 client_reconnect_try() {