From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: Andrea Parri <parri.andrea@gmail.com>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Keith Busch <kbusch@kernel.org>,
Sagi Grimberg <sagi@grimberg.me>,
Chaitanya Kulkarni <kch@nvidia.com>,
Daniel Wagner <dwagner@suse.de>,
linux-nvme@lists.infradead.org
Subject: Re: [PATCH blktests 2/4] nvme/071: test that nvmet sends no data for a failed read
Date: Tue, 20 Oct 2026 19:35:53 +0900 [thread overview]
Message-ID: <atdDDxISK3i_5uQX@shinmob> (raw)
In-Reply-To: <20261014170046.2516-3-parri.andrea@gmail.com>
On Oct 14, 2026 / 19:00, Andrea Parri wrote:
> Issue a failing Identify into a buffer filled with a sentinel and verify
> that the target transfers no data, with a successful Identify and a
> namespace read as controls. The test runs on every configured transport;
> only nvmet-fc failed it before the fix. Add a small helper because
> nvme-cli cannot prefill the data buffer.
>
> The test fails over fc on the unpatched kernel and passes with the fix
> applied.
[...]
> diff --git a/tests/nvme/071 b/tests/nvme/071
> new file mode 100755
> index 0000000000000..5333bfac8db53
> --- /dev/null
> +++ b/tests/nvme/071
> @@ -0,0 +1,80 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-3.0+
> +# Copyright (C) 2026 Andrea Parri
> +#
> +# Check that the NVMe target transfers no read data for a failed command.
> +# The host buffer is filled with a sentinel, so any data the target sends
> +# shows up as changed bytes.
> +#
> +# Regression test for patch "nvmet-fc: only send read data for successful
> +# commands".
> +
> +. tests/nvme/rc
> +
> +DESCRIPTION="verify nvmet does not transfer data for failed reads"
> +QUICK=1
> +
> +requires() {
> + _nvme_requires
> + _have_loop
> + _require_kernel_nvme_target
> + _have_src_program nvme-sentinel-read
> +}
> +
> +set_conditions() {
> + _set_nvme_trtype "$@"
> +}
> +
> +# Issue an Identify with CNS $2 to controller $1 and print the NVMe status
> +# and the number of changed bytes in the 4096-byte data buffer.
> +_identify() {
In most cases, the function names that start with underscore are used for
helper functions in common scripts. This function is used only in this script
file, I suggest a function name that does not start with underscore. How about
issue_identify() ?
> + src/nvme-sentinel-read "$1" 0x06 "$2" 4096 2>>"$FULL"
> +}
> +
> +test() {
> + echo "Running ${TEST_NAME}"
> +
> + local changed ctrl ns status
> +
> + _setup_nvmet
> + # File backing: the namespace read below fails over loop with the
> + # default loop device backing, for reasons unrelated to this test.
> + _nvmet_target_setup --blkdev file
> + _nvme_connect_subsys
> +
> + ctrl=$(_find_nvme_dev "$def_subsysnqn")
> + ns="/dev/${ctrl}n1"
> +
> + # Identify Controller succeeds and must overwrite the sentinel.
> + if ! read -r status changed < <(_identify "/dev/$ctrl" 0x01); then
> + echo "successful Identify could not be issued"
> + else
> + echo "cns=0x01 status=$status changed=$changed" >>"$FULL"
> + if ((status != 0 || changed == 0)); then
> + echo "successful Identify returned status $status with $changed bytes"
> + fi
> + fi
> +
> + # An unsupported CNS fails and must leave the sentinel intact.
> + if ! read -r status changed < <(_identify "/dev/$ctrl" 0xff); then
> + echo "failed Identify could not be issued"
> + else
> + echo "cns=0xff status=$status changed=$changed" >>"$FULL"
> + if (((status & 0x7ff) != 2)); then
> + echo "failed Identify returned status $status, expected 0x2"
> + fi
> + if ((changed != 0)); then
> + echo "failed Identify transferred data: $changed bytes changed"
> + fi
> + fi
Do we really need this dd part below? As far as I understand, the core part of
this test case is Identify command part above.
> +
> + if ! dd if="$ns" of=/dev/null bs=4096 count=256 iflag=direct \
> + status=none >>"$FULL" 2>&1; then
> + echo "namespace read failed"
> + fi
> +
> + _nvme_disconnect_subsys
> + _nvmet_target_cleanup
> +
> + echo "Test complete"
> +}
next prev parent reply other threads:[~2026-10-20 10:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 17:00 [PATCH blktests 0/4] nvme: add nvmet zone report and FC regression tests Andrea Parri
2026-10-14 17:00 ` [PATCH blktests 1/4] nvme/rc: add zoned null_blk target helpers Andrea Parri
2026-10-20 10:31 ` Shin'ichiro Kawasaki
2026-10-14 17:00 ` [PATCH blktests 2/4] nvme/071: test that nvmet sends no data for a failed read Andrea Parri
2026-10-20 10:35 ` Shin'ichiro Kawasaki [this message]
2026-10-20 15:17 ` Andrea Parri
2026-10-14 17:00 ` [PATCH blktests 3/4] nvme/072: test nvmet zone report initialization and length Andrea Parri
2026-10-20 10:38 ` Shin'ichiro Kawasaki
2026-10-14 17:00 ` [PATCH blktests 4/4] nvme/073: test that nvmet rejects a zone report NUMD that wraps Andrea Parri
2026-10-20 10:41 ` [PATCH blktests 0/4] nvme: add nvmet zone report and FC regression tests Shin'ichiro Kawasaki
2026-10-20 15:18 ` Andrea Parri
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=atdDDxISK3i_5uQX@shinmob \
--to=shinichiro.kawasaki@wdc.com \
--cc=dwagner@suse.de \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=parri.andrea@gmail.com \
--cc=sagi@grimberg.me \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox