[PATCH blktests v2 07/13] nvme: return error from _find_nvme_ns()

Shin'ichiro Kawasaki shinichiro.kawasaki at wdc.com
Tue Oct 29 23:51:43 PDT 2024


From: Hannes Reinecke <hare at suse.de>

When _find_nvme_ns() fails it should return a non-zero statue to allow for
the error to be propagated to the caller.

Signed-off-by: Hannes Reinecke <hare at suse.de>
Reviewed-by: Daniel Wagner <dwagner at suse.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
---
 common/nvme | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/nvme b/common/nvme
index 2ef9fd8..5d2e38e 100644
--- a/common/nvme
+++ b/common/nvme
@@ -694,8 +694,10 @@ _find_nvme_dev() {
 		subsysnqn="$(cat "/sys/class/nvme/${dev}/subsysnqn" 2>/dev/null)"
 		if [[ "$subsysnqn" == "$subsys" ]]; then
 			echo "$dev"
+			return 0
 		fi
 	done
+	return 1
 }
 
 _find_nvme_ns() {
@@ -712,8 +714,10 @@ _find_nvme_ns() {
 		uuid=$(cat "${ns}/uuid")
 		if [[ "${subsys_uuid}" == "${uuid}" ]]; then
 			basename "${ns}"
+			return 0
 		fi
 	done
+	return 1
 }
 
 _nvmet_target_cleanup() {
-- 
2.45.2




More information about the Linux-nvme mailing list