All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Qiliang Yuan" <qiliang.yuan@linux.dev>
Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
Subject: Re: [PATCH RFC 17/18] selftests: target_core_uring: Test a device exported through tcm_loop
Date: Mon, 16 Nov 2026 00:49:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-215971@kernel.org> (raw)
In-Reply-To: <20261115-feat-target-core-uring-v1-17-28cdc137eac6@linux.dev>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] selftests: target_core_uring: missing CONFIG_SCSI, sd_mod
  load, and dev check
- [Low] selftests: target_core_uring: mktemp leak on skip and missing
  EXIT trap
- [Low] selftests: target_core_uring: hand-rolled TAP output in
  tcmur_test.sh
--

commit 6f0f6d18ce018c3449526ab2ffc205257d98be91
Author: Qiliang Yuan <qiliang.yuan@linux.dev>

selftests: target_core_uring: Test a device exported through tcm_loop

This commit adds a kselftest script and kernel config fragment that export a
target_core_uring device via tcm_loop, serve it with tcmur_server, and verify
I/O, server restart, and command timeouts against the backing file.

> diff --git a/tools/testing/selftests/target_core_uring/tcmur_test.sh b/tools/testing/selftests/target_core_uring/tcmur_test.sh
> new file mode 100755
> index 0000000000000..99f68e74c7cd0
> --- /dev/null
> +++ b/tools/testing/selftests/target_core_uring/tcmur_test.sh
> @@ -0,0 +1,137 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Export a target_core_uring device through tcm_loop, serve it with
> +# tcmur_server and check the resulting SCSI disk against the backing file.
> +
> +DIR=$(dirname "$(readlink -f "$0")")
> +KSFT_SKIP=4
> +T=/sys/kernel/config/target
> +C=$T/core/uring_70/tcmur_test
> +WWN=naa.5001405074636d75
> +L=$T/loopback/$WWN/tpgt_1
> +SIZE=$((256 << 20))
> +IMG=$(mktemp /tmp/tcmur_test.XXXXXX)
> +PAT=$(mktemp /tmp/tcmur_test.XXXXXX)
> +server=
> +dev=
> +fail=0
> +
> +[ "$(id -u)" = 0 ] || { echo "SKIP: need root"; exit $KSFT_SKIP; }
> +modprobe -q target_core_uring && modprobe -q tcm_loop ||
> +	{ echo "SKIP: need target_core_uring and tcm_loop"; exit $KSFT_SKIP; }

[Severity: Low]
Does exiting on the root or module skip checks leak the IMG and PAT files in
/tmp?  IMG and PAT are created with mktemp before the prerequisite checks, and
rm -f "$IMG" "$PAT" only runs at the end of the script.  Without an EXIT trap,
an interrupted or timed-out test run also leaves IMG, PAT, the background
tcmur_server process, and the configfs entries behind.

> +
> +check() {	# <name> <command...>
> +	local name=$1; shift
> +
> +	if "$@"; then
> +		echo "ok $name"
> +	else
> +		echo "not ok $name"
> +		fail=1
> +	fi
> +}

[Severity: Low]
This isn't a bug, but could tcmur_test.sh source
tools/testing/selftests/kselftest/ktap_helpers.sh instead of hand-rolling
KSFT_SKIP, check(), and the skip messages?  Using ktap_print_header(),
ktap_set_plan(), ktap_skip_all(), ktap_test_result(), ktap_test_skip(), and
ktap_finished() would emit standard KTAP headers, test numbers, and summary
totals.

[ ... ]

> +	before=$(lsblk -dno NAME | sort)
> +	mkdir -p $L
> +	echo naa.5001405074636d76 > $L/nexus
> +	mkdir $L/lun/lun_0
> +	ln -s $C $L/lun/lun_0/tcmur_test
> +	for _ in $(seq 40); do
> +		dev=$(comm -13 <(echo "$before") <(lsblk -dno NAME | sort) | head -1)
> +		[ -n "$dev" ] && break
> +		sleep 0.5
> +	done
> +	udevadm settle
> +	dev=/dev/$dev
> +}

[Severity: Medium]
What happens in setup() if the SCSI disk never appears in lsblk?

After polling for 20 seconds, dev remains empty and dev=/dev/$dev sets dev to
/dev/, causing each of the four setup() calls to stall for 20 seconds (exceeding
the default 45-second kselftest timeout) before running dd and blkdiscard
against /dev/.

This is easy to hit in minimal test environments for two reasons:
tools/testing/selftests/target_core_uring/config sets CONFIG_LOOPBACK_TARGET=m
and CONFIG_BLK_DEV_SD=m without enabling CONFIG_SCSI, which both symbols depend
on (CONFIG_TARGET_CORE only selects CONFIG_SCSI_COMMON), so Kconfig drops them
when merging onto a base config without CONFIG_SCSI.  In addition, the
prerequisite check at the top of the script loads target_core_uring and
tcm_loop, but does not load sd_mod (for CONFIG_BLK_DEV_SD=m) or verify that
configfs is mounted at /sys/kernel/config/target.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261115-feat-target-core-uring-v1-0-28cdc137eac6@linux.dev?part=17

  reply	other threads:[~2026-11-16  0:49 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  0:17 [PATCH RFC 00/18] scsi: target: Add target_core_uring, an io_uring based user backstore Qiliang Yuan
2026-11-16  0:17 ` [PATCH RFC 01/18] scsi: target: uring: Introduce " Qiliang Yuan
2026-11-16  0:38   ` sashiko-bot
2026-11-16  0:17 ` [PATCH RFC 02/18] scsi: target: uring: Allocate per-queue command descriptors Qiliang Yuan
2026-11-16  0:17 ` [PATCH RFC 03/18] scsi: target: uring: Create a character device per backstore device Qiliang Yuan
2026-11-16  0:33   ` sashiko-bot
2026-11-16  0:17 ` [PATCH RFC 04/18] scsi: target: uring: Map the command descriptors into the server Qiliang Yuan
2026-11-16  0:17 ` [PATCH RFC 05/18] scsi: target: uring: Queue commands until a server fetches them Qiliang Yuan
2026-11-16  0:46   ` sashiko-bot
2026-11-16  0:17 ` [PATCH RFC 06/18] scsi: target: uring: Hand commands out through TCMUR_IO_FETCH Qiliang Yuan
2026-11-16  0:18 ` [PATCH RFC 07/18] scsi: target: uring: Complete commands with TCMUR_IO_COMMIT_AND_FETCH Qiliang Yuan
2026-11-16  0:18 ` [PATCH RFC 08/18] scsi: target: uring: Copy command data with pread() and pwrite() Qiliang Yuan
2026-11-16  0:18 ` [PATCH RFC 09/18] scsi: target: uring: Fail in-flight commands when the server exits Qiliang Yuan
2026-11-16  0:18 ` [PATCH RFC 10/18] scsi: target: uring: Time out commands the server does not complete Qiliang Yuan
2026-11-16  0:41   ` sashiko-bot
2026-11-16  0:18 ` [PATCH RFC 11/18] scsi: target: uring: Drop aborted commands that are still queued Qiliang Yuan
2026-11-16  0:37   ` sashiko-bot
2026-11-16  0:18 ` [PATCH RFC 12/18] scsi: target: uring: Support SYNCHRONIZE CACHE Qiliang Yuan
2026-11-16  0:40   ` sashiko-bot
2026-11-16  0:18 ` [PATCH RFC 13/18] scsi: target: uring: Implement UNMAP Qiliang Yuan
2026-11-16  0:45   ` sashiko-bot
2026-11-16  0:18 ` [PATCH RFC 14/18] scsi: target: uring: Handle WRITE SAME Qiliang Yuan
2026-11-16  0:44   ` sashiko-bot
2026-11-16  0:18 ` [PATCH RFC 15/18] scsi: target: uring: Register command data as io_uring fixed buffers Qiliang Yuan
2026-11-16  0:18 ` [PATCH RFC 16/18] selftests: target_core_uring: Add a minimal server Qiliang Yuan
2026-11-16  1:03   ` sashiko-bot
2026-11-16  0:18 ` [PATCH RFC 17/18] selftests: target_core_uring: Test a device exported through tcm_loop Qiliang Yuan
2026-11-16  0:49   ` sashiko-bot [this message]
2026-11-16  0:18 ` [PATCH RFC 18/18] Documentation: target: Describe the uring backstore Qiliang Yuan
2026-11-16  2:32 ` [PATCH RFC 00/18] scsi: target: Add target_core_uring, an io_uring based user backstore Ming Lei
2026-11-17  2:46   ` Qiliang Yuan
2026-11-18  1:40     ` Ming Lei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-215971@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=qiliang.yuan@linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.