From a673bfe9fb0649d7e3bfc3fd8ae83e3874f238f4 Mon Sep 17 00:00:00 2001 From: Zorro Lang Date: Mon, 23 Jun 2025 04:39:47 +0800 Subject: [PATCH] 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. Reviewed-by: Darrick J. Wong Signed-off-by: Zorro Lang --- common/rc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/rc b/common/rc index 3c5a54a6..96578d15 100644 --- a/common/rc +++ b/common/rc @@ -4812,6 +4812,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" -- 2.39.5