Skip to contentSkip to conversation

common/rc: remove useless _pgrep funcion

PATCH In review Zorro Lang 3 participants 5 messages Jun 22, 2025 – Jul 10, 2025

lore
Share & tools
lore

Zorro Lang

author
#0 lore raw

PATCH 1/2 common/rc: remove useless _pgrep funcion

The _pgrep() function isn't used anymore, remove it.

---
 common/rc | 10 ----------
 1 file changed, 10 deletions(-)
common/rc +0 -10
index fbab26b25..a27f87a0b 100644
@@ -36,16 +36,6 @@ _pkill()
 	pkill "$@"
 }
 
-# Find only the test processes started by this test
-_pgrep()
-{
-	if [ "$FSTESTS_ISOL" = "setsid" ]; then
-		pgrep --session 0 "$@"
-	else
-		pgrep "$@"
-	fi
-}
-
 # Common execution handling for fsstress invocation.
 #
 # We need per-test fsstress binaries because of the way fsstress forks and
Signature · 1 line
2.47.1
author
#1 lore raw

PATCH 2/2 common/rc: _add_dmesg_filter returns when RESULT_DIR is null

I always hit below error on a system with readonly rootfs:

++ _xfs_prepare_for_eio_shutdown /dev/loop0
...
++ _add_dmesg_filter 'Internal error'
++ local 'regexp=Internal error'
++ local filter_file=/dmesg_filter
++ '[' '!' -e /dmesg_filter ']'
++ echo 'Internal error'
./common/rc: line 4716: /dmesg_filter: Read-only file system

The RESULT_DIR is null, due to xfstests/check calls _test_mount and _scratch_mount before RESULT_DIR creation. And _test_mount does _prepare_for_eio_shutdown -> _xfs_prepare_for_eio_shutdown -> _add_dmesg_filter "Internal error" when RESULT_DIR is null.

---
 common/rc | 6 ++++++
 1 file changed, 6 insertions(+)
common/rc +6 -0
index a27f87a0b..549f42135 100644
@@ -4800,6 +4800,12 @@ _check_dmesg_filter()
 # Add a simple expression to the default dmesg filter
 _add_dmesg_filter()
 {
+	# This function might be called before having RESULT_DIR, do nothing
+	# if RESULT_DIR isn't created
+	if [ ! -d "${RESULT_DIR}" ];then
+		return 1
+	fi
+
 	local regexp="$1"
 	local filter_file="${RESULT_DIR}/dmesg_filter"
 
Signature · 1 line
2.47.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] common/rc: _add_dmesg_filter returns when RESULT_DIR is null

Quoted 11 lines · Zorro Lang

I always hit below error on a system with readonly rootfs:

++ _xfs_prepare_for_eio_shutdown /dev/loop0
...
++ _add_dmesg_filter 'Internal error'
++ local 'regexp=Internal error'
++ local filter_file=/dmesg_filter
++ '[' '!' -e /dmesg_filter ']'
++ echo 'Internal error'
./common/rc: line 4716: /dmesg_filter: Read-only file system

Quoted 6 lines

The RESULT_DIR is null, due to xfstests/check calls _test_mount and _scratch_mount before RESULT_DIR creation. And _test_mount does _prepare_for_eio_shutdown -> _xfs_prepare_for_eio_shutdown -> _add_dmesg_filter "Internal error" when RESULT_DIR is null.

Looks good,

--D

Quoted 25 lines
---
 common/rc | 6 ++++++
 1 file changed, 6 insertions(+)
common/rc +6 -0
index a27f87a0b..549f42135 100644
@@ -4800,6 +4800,12 @@ _check_dmesg_filter()
 # Add a simple expression to the default dmesg filter
 _add_dmesg_filter()
 {
+	# This function might be called before having RESULT_DIR, do nothing
+	# if RESULT_DIR isn't created
+	if [ ! -d "${RESULT_DIR}" ];then
+		return 1
+	fi
+
 	local regexp="$1"
 	local filter_file="${RESULT_DIR}/dmesg_filter"
 
Signature · 1 line
2.47.1
#3 lore raw
In reply to Zorro Lang
Quoted 4 lines · Zorro Lang

The _pgrep() function isn't used anymore, remove it.

---

Ping.

Could anyone help to give my 2 small patches a reviewing :)

Thanks,
Zorro

Quoted 28 lines
 common/rc | 10 ----------
 1 file changed, 10 deletions(-)
common/rc +0 -10
index fbab26b25..a27f87a0b 100644
@@ -36,16 +36,6 @@ _pkill()
 	pkill "$@"
 }
 
-# Find only the test processes started by this test
-_pgrep()
-{
-	if [ "$FSTESTS_ISOL" = "setsid" ]; then
-		pgrep --session 0 "$@"
-	else
-		pgrep "$@"
-	fi
-}
-
 # Common execution handling for fsstress invocation.
 #
 # We need per-test fsstress binaries because of the way fsstress forks and
Signature · 1 line
2.47.1
Reviewed-by on v1 1/2
#4 lore raw
In reply to Zorro Lang
Quoted 3 lines · Zorro Lang

The _pgrep() function isn't used anymore, remove it.

Yeah, seems fine to me.

--D

Quoted 29 lines
---
 common/rc | 10 ----------
 1 file changed, 10 deletions(-)
common/rc +0 -10
index fbab26b25..a27f87a0b 100644
@@ -36,16 +36,6 @@ _pkill()
 	pkill "$@"
 }
 
-# Find only the test processes started by this test
-_pgrep()
-{
-	if [ "$FSTESTS_ISOL" = "setsid" ]; then
-		pgrep --session 0 "$@"
-	else
-		pgrep "$@"
-	fi
-}
-
 # Common execution handling for fsstress invocation.
 #
 # We need per-test fsstress binaries because of the way fsstress forks and
Signature · 1 line
2.47.1