[PATCH blktests] nvme/054: fix nvme reservation preempt and clear operations

Yi Zhang yi.zhang at redhat.com
Fri Aug 22 08:00:06 PDT 2025


This patch fixes two issues in the NVMe reservation test:
1. Missing --prkey parameter for Preempt operation:
   According to the nvme-cli documentation, when using resv-acquire
   with --racqa=1 (Preempt), the --prkey parameter is required to
   specify which reservation key to preempt. Without this parameter,
   the command fails with "Invalid Field in Command" error on some
   NVMe controllers.

2. Redundant registration in Clear operation:
   After a reservation release with --rrela=0, the registration
   remains valid. The subsequent resv-register command attempts
   to register with the same key, causing a "Reservation Conflict"
   error. This redundant registration is unnecessary and should
   be removed.

These issues were discovered during my nvme reservation test with
the same steps on NetApp storage connected via NVMe/RDMA.

Link: https://github.com/linux-blktests/blktests/issues/190
Signed-off-by: Yi Zhang <yi.zhang at redhat.com>
---
 tests/nvme/054     | 3 +--
 tests/nvme/054.out | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/nvme/054 b/tests/nvme/054
index 0a9ac80..08e3a00 100755
--- a/tests/nvme/054
+++ b/tests/nvme/054
@@ -55,7 +55,7 @@ test_resv() {
 	resv_report "${test_dev}" "${report_arg}"
 
 	echo "Preempt"
-	nvme resv-acquire "${test_dev}" --crkey=4 --rtype=2 --racqa=1
+	nvme resv-acquire "${test_dev}" --crkey=4 --prkey=4 --rtype=2 --racqa=1
 	resv_report "${test_dev}" "${report_arg}"
 
 	echo "Release"
@@ -63,7 +63,6 @@ test_resv() {
 	resv_report "${test_dev}" "${report_arg}"
 
 	echo "Clear"
-	nvme resv-register "${test_dev}" --nrkey=4 --rrega=0
 	nvme resv-acquire "${test_dev}" --crkey=4 --rtype=1 --racqa=0
 	resv_report "${test_dev}" "${report_arg}"
 	nvme resv-release "${test_dev}" --crkey=4 --rrela=1
diff --git a/tests/nvme/054.out b/tests/nvme/054.out
index 5adb30d..9c92668 100644
--- a/tests/nvme/054.out
+++ b/tests/nvme/054.out
@@ -54,9 +54,8 @@ regctlext[0] :
   rcsts      : 0
   rkey       : 4
 Clear
-NVME Reservation  success
 NVME Reservation Acquire success
-gen       : 6
+gen       : 5
 rtype     : 1
 regctl    : 1
 regctlext[0] :
-- 
2.45.1




More information about the Linux-nvme mailing list