Linux-Block Archive mirror
 help / color / mirror / Atom feed
* [PATCH blktests v2 0/5] fc transport cleanups
@ 2024-02-12 10:40 Daniel Wagner
  2024-02-12 10:40 ` [PATCH blktests v2 1/5] nvme/029: fix local variable declarations Daniel Wagner
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Daniel Wagner @ 2024-02-12 10:40 UTC (permalink / raw
  To: Shin'ichiro Kawasaki
  Cc: linux-block, linux-nvme, Chaitanya Kulkarni, Daniel Wagner

Fixed the typos and collected the RB tags. 

changes:
v2:
  - typo fixes
  - collected RB tags
  
v1:
  - initial version
  - https://lore.kernel.org/linux-nvme/20240206131655.32050-1-dwagner@suse.de/

Daniel Wagner (5):
  nvme/029: fix local variable declarations
  nvme/rc: filter out errors from cat when reading files
  nvme/rc: do not issue warnings on cleanup when using fc transport
  nvme/rc: do not issue errors when disconnecting when using fc
    transport
  nvme/rc: revert nvme-cli context tracking

 tests/nvme/029 |  2 +-
 tests/nvme/rc  | 73 +++++---------------------------------------------
 2 files changed, 8 insertions(+), 67 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH blktests v2 1/5] nvme/029: fix local variable declarations
  2024-02-12 10:40 [PATCH blktests v2 0/5] fc transport cleanups Daniel Wagner
@ 2024-02-12 10:40 ` Daniel Wagner
  2024-02-12 10:40 ` [PATCH blktests v2 2/5] nvme/rc: filter out errors from cat when reading files Daniel Wagner
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Daniel Wagner @ 2024-02-12 10:40 UTC (permalink / raw
  To: Shin'ichiro Kawasaki
  Cc: linux-block, linux-nvme, Chaitanya Kulkarni, Daniel Wagner,
	Chaitanya Kulkarni

The syntax for local variables declarations uses whitespace as separator
and not commas:

tests/nvme/029: line 24: local: `bs,': not a valid identifier
tests/nvme/029: line 24: local: `size,': not a valid identifier
tests/nvme/029: line 24: local: `img,': not a valid identifier

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 tests/nvme/029 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/nvme/029 b/tests/nvme/029
index caed0f7ec476..db6e8b91f707 100755
--- a/tests/nvme/029
+++ b/tests/nvme/029
@@ -21,7 +21,7 @@ test_user_io()
 	local disk="$1"
 	local start=$2
 	local cnt=$3
-	local bs, size, img, img1
+	local bs size img img1
 
 	bs="$(blockdev --getss "$disk")"
 	size=$((cnt * bs))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH blktests v2 2/5] nvme/rc: filter out errors from cat when reading files
  2024-02-12 10:40 [PATCH blktests v2 0/5] fc transport cleanups Daniel Wagner
  2024-02-12 10:40 ` [PATCH blktests v2 1/5] nvme/029: fix local variable declarations Daniel Wagner
@ 2024-02-12 10:40 ` Daniel Wagner
  2024-02-12 10:40 ` [PATCH blktests v2 3/5] nvme/rc: do not issue warnings on cleanup when using fc transport Daniel Wagner
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Daniel Wagner @ 2024-02-12 10:40 UTC (permalink / raw
  To: Shin'ichiro Kawasaki
  Cc: linux-block, linux-nvme, Chaitanya Kulkarni, Daniel Wagner

When running the tests with FC as transport and the udev auto connect
enabled, discovery controllers are created and destroyed while the tests
are running. This races with the cleanup code and also the
_find_nvme_dev() which iterates over all device entries and tries to
read the connect of transport and subsysnqn sysfs attributes. Since
these steps are not locked in anyway, the resources can go away in
between.

Thus filter out 'cat' reporting non existing subsysnqn or transport
attributes. The tests will still fail if they can't find the device etc.
But without filtering these errors out the tests fail randomly.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 tests/nvme/rc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/nvme/rc b/tests/nvme/rc
index e0461f1cd53a..9cc83afe0668 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -350,7 +350,7 @@ _cleanup_nvmet() {
 
 	for dev in /sys/class/nvme/nvme*; do
 		dev="$(basename "$dev")"
-		transport="$(cat "/sys/class/nvme/${dev}/transport")"
+		transport="$(cat "/sys/class/nvme/${dev}/transport" 2>/dev/null)"
 		if [[ "$transport" == "${nvme_trtype}" ]]; then
 			echo "WARNING: Test did not clean up ${nvme_trtype} device: ${dev}"
 			_nvme_disconnect_ctrl "${dev}"
@@ -840,7 +840,7 @@ _find_nvme_dev() {
 	for dev in /sys/class/nvme/nvme*; do
 		[ -e "$dev" ] || continue
 		dev="$(basename "$dev")"
-		subsysnqn="$(cat "/sys/class/nvme/${dev}/subsysnqn")"
+		subsysnqn="$(cat "/sys/class/nvme/${dev}/subsysnqn" 2>/dev/null)"
 		if [[ "$subsysnqn" == "$subsys" ]]; then
 			echo "$dev"
 		fi
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH blktests v2 3/5] nvme/rc: do not issue warnings on cleanup when using fc transport
  2024-02-12 10:40 [PATCH blktests v2 0/5] fc transport cleanups Daniel Wagner
  2024-02-12 10:40 ` [PATCH blktests v2 1/5] nvme/029: fix local variable declarations Daniel Wagner
  2024-02-12 10:40 ` [PATCH blktests v2 2/5] nvme/rc: filter out errors from cat when reading files Daniel Wagner
@ 2024-02-12 10:40 ` Daniel Wagner
  2024-02-12 10:40 ` [PATCH blktests v2 4/5] nvme/rc: do not issue errors when disconnecting " Daniel Wagner
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Daniel Wagner @ 2024-02-12 10:40 UTC (permalink / raw
  To: Shin'ichiro Kawasaki
  Cc: linux-block, linux-nvme, Chaitanya Kulkarni, Daniel Wagner

When running the tests with FC as transport and the udev auto connect
enabled, discovery controllers are created and destroyed while the tests
are running.

The cleanup code expects that all devices are under blktests control,
but this isn't the case. So just disable the warning as it is reporting
a lot of false positives.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 tests/nvme/rc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/nvme/rc b/tests/nvme/rc
index 9cc83afe0668..ca6a284a1e25 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -352,7 +352,10 @@ _cleanup_nvmet() {
 		dev="$(basename "$dev")"
 		transport="$(cat "/sys/class/nvme/${dev}/transport" 2>/dev/null)"
 		if [[ "$transport" == "${nvme_trtype}" ]]; then
-			echo "WARNING: Test did not clean up ${nvme_trtype} device: ${dev}"
+			# if udev auto connect is enabled for FC we get false positives
+			if [[ "$transport" != "fc" ]]; then
+				echo "WARNING: Test did not clean up ${nvme_trtype} device: ${dev}"
+			fi
 			_nvme_disconnect_ctrl "${dev}"
 		fi
 	done
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH blktests v2 4/5] nvme/rc: do not issue errors when disconnecting when using fc transport
  2024-02-12 10:40 [PATCH blktests v2 0/5] fc transport cleanups Daniel Wagner
                   ` (2 preceding siblings ...)
  2024-02-12 10:40 ` [PATCH blktests v2 3/5] nvme/rc: do not issue warnings on cleanup when using fc transport Daniel Wagner
@ 2024-02-12 10:40 ` Daniel Wagner
  2024-02-12 10:40 ` [PATCH blktests v2 5/5] nvme/rc: revert nvme-cli context tracking Daniel Wagner
  2024-02-13 10:54 ` [PATCH blktests v2 0/5] fc transport cleanups Shinichiro Kawasaki
  5 siblings, 0 replies; 7+ messages in thread
From: Daniel Wagner @ 2024-02-12 10:40 UTC (permalink / raw
  To: Shin'ichiro Kawasaki
  Cc: linux-block, linux-nvme, Chaitanya Kulkarni, Daniel Wagner

When running the tests with FC as transport and the udev auto connect
enabled, discovery controllers are created and destroyed while the tests
are running.

The cleanup code expects that all devices are under blktests control,
but this isn't the case. Thus filter out disconnect failures as well.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 tests/nvme/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/nvme/rc b/tests/nvme/rc
index ca6a284a1e25..cdfc738d3aec 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -356,7 +356,7 @@ _cleanup_nvmet() {
 			if [[ "$transport" != "fc" ]]; then
 				echo "WARNING: Test did not clean up ${nvme_trtype} device: ${dev}"
 			fi
-			_nvme_disconnect_ctrl "${dev}"
+			_nvme_disconnect_ctrl "${dev}" 2>/dev/null
 		fi
 	done
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH blktests v2 5/5] nvme/rc: revert nvme-cli context tracking
  2024-02-12 10:40 [PATCH blktests v2 0/5] fc transport cleanups Daniel Wagner
                   ` (3 preceding siblings ...)
  2024-02-12 10:40 ` [PATCH blktests v2 4/5] nvme/rc: do not issue errors when disconnecting " Daniel Wagner
@ 2024-02-12 10:40 ` Daniel Wagner
  2024-02-13 10:54 ` [PATCH blktests v2 0/5] fc transport cleanups Shinichiro Kawasaki
  5 siblings, 0 replies; 7+ messages in thread
From: Daniel Wagner @ 2024-02-12 10:40 UTC (permalink / raw
  To: Shin'ichiro Kawasaki
  Cc: linux-block, linux-nvme, Chaitanya Kulkarni, Daniel Wagner,
	Chaitanya Kulkarni

This feature is not needed anymore, after fixing nvmet-fc. The nvmet
target code is able to handle parallel operations and doesn't crash
anymore. Furthermore, it can't prevent from discovery controller created
by the udev rules, so let's rip it out.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 tests/nvme/rc | 62 ---------------------------------------------------
 1 file changed, 62 deletions(-)

diff --git a/tests/nvme/rc b/tests/nvme/rc
index cdfc738d3aec..dfc4c1ef1975 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -189,57 +189,6 @@ _nvme_calc_rand_io_size() {
 	echo "${io_size_kb}k"
 }
 
-_have_nvme_cli_context() {
-	# ignore all non-fc transports for now
-	if [[ "${nvme_trtype}" != "fc" ]] ||
-	   ! nvme connect --help 2>&1 | grep -q -- '--context=<STR>' > /dev/null; then
-		return 1
-	fi
-	return 0
-}
-
-_setup_nvme_cli() {
-	local local_wwnn="${1}"
-	local local_wwpn="${2}"
-	local remote_wwnn="${3}"
-	local remote_wwpn="${4}"
-
-	if ! _have_nvme_cli_context; then
-		return
-	fi
-
-	mkdir -p /run/nvme
-	cat >> /run/nvme/blktests.json <<-EOF
-	[
-	  {
-	    "hostnqn": "${def_hostnqn}",
-	    "hostid": "${def_hostid}",
-	    "subsystems": [
-	      {
-	        "application": "blktests",
-	        "nqn": "blktests-subsystem-1",
-	        "ports": [
-	          {
-	            "transport": "fc",
-	            "traddr": "nn-${remote_wwnn}:pn-${remote_wwpn}",
-	            "host_traddr": "nn-${local_wwnn}:pn-${local_wwpn}"
-	          }
-	        ]
-	      }
-	    ]
-	  }
-	]
-	EOF
-}
-
-_cleanup_nvme_cli() {
-	if ! _have_nvme_cli_context; then
-		return
-	fi
-
-	rm -f /run/nvme/blktests.json
-}
-
 _nvme_fcloop_add_rport() {
 	local local_wwnn="$1"
 	local local_wwpn="$2"
@@ -272,9 +221,6 @@ _setup_fcloop() {
 	local remote_wwnn="${3:-$def_remote_wwnn}"
 	local remote_wwpn="${4:-$def_remote_wwpn}"
 
-	_setup_nvme_cli "${local_wwnn}" "${local_wwpn}" \
-			"${remote_wwnn}" "${remote_wwpn}"
-
 	_nvme_fcloop_add_tport "${remote_wwnn}" "${remote_wwpn}"
 	_nvme_fcloop_add_lport "${local_wwnn}" "${local_wwpn}"
 	_nvme_fcloop_add_rport "${local_wwnn}" "${local_wwpn}" \
@@ -317,8 +263,6 @@ _cleanup_fcloop() {
 	_nvme_fcloop_del_lport "${local_wwnn}" "${local_wwpn}"
 	_nvme_fcloop_del_rport "${local_wwnn}" "${local_wwpn}" \
 			       "${remote_wwnn}" "${remote_wwpn}"
-
-	_cleanup_nvme_cli
 }
 
 _cleanup_blkdev() {
@@ -544,9 +488,6 @@ _nvme_connect_subsys() {
 	subsysnqn="$2"
 
 	ARGS=(-t "${trtype}" -n "${subsysnqn}")
-	if _have_nvme_cli_context; then
-		ARGS+=(--context="blktests")
-	fi
 	if [[ "${trtype}" == "fc" ]] ; then
 		ARGS+=(-a "${traddr}" -w "${host_traddr}")
 	elif [[ "${trtype}" != "loop" ]]; then
@@ -618,9 +559,6 @@ _nvme_discover() {
 	ARGS=(-t "${trtype}")
 	ARGS+=(--hostnqn="${def_hostnqn}")
 	ARGS+=(--hostid="${def_hostid}")
-	if _have_nvme_cli_context; then
-		ARGS+=(--context="blktests")
-	fi
 	if [[ "${trtype}" = "fc" ]]; then
 		ARGS+=(-a "${traddr}" -w "${host_traddr}")
 	elif [[ "${trtype}" != "loop" ]]; then
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH blktests v2 0/5] fc transport cleanups
  2024-02-12 10:40 [PATCH blktests v2 0/5] fc transport cleanups Daniel Wagner
                   ` (4 preceding siblings ...)
  2024-02-12 10:40 ` [PATCH blktests v2 5/5] nvme/rc: revert nvme-cli context tracking Daniel Wagner
@ 2024-02-13 10:54 ` Shinichiro Kawasaki
  5 siblings, 0 replies; 7+ messages in thread
From: Shinichiro Kawasaki @ 2024-02-13 10:54 UTC (permalink / raw
  To: Daniel Wagner
  Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
	Chaitanya Kulkarni

On Feb 12, 2024 / 11:40, Daniel Wagner wrote:
> Fixed the typos and collected the RB tags. 
> 
> changes:
> v2:
>   - typo fixes
>   - collected RB tags

Thank you for the changes in v2. Applied.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-02-13 10:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-12 10:40 [PATCH blktests v2 0/5] fc transport cleanups Daniel Wagner
2024-02-12 10:40 ` [PATCH blktests v2 1/5] nvme/029: fix local variable declarations Daniel Wagner
2024-02-12 10:40 ` [PATCH blktests v2 2/5] nvme/rc: filter out errors from cat when reading files Daniel Wagner
2024-02-12 10:40 ` [PATCH blktests v2 3/5] nvme/rc: do not issue warnings on cleanup when using fc transport Daniel Wagner
2024-02-12 10:40 ` [PATCH blktests v2 4/5] nvme/rc: do not issue errors when disconnecting " Daniel Wagner
2024-02-12 10:40 ` [PATCH blktests v2 5/5] nvme/rc: revert nvme-cli context tracking Daniel Wagner
2024-02-13 10:54 ` [PATCH blktests v2 0/5] fc transport cleanups Shinichiro Kawasaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).