From 9d2615484a002bc74e937ff5a0be2ad080f0a3a1 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 13 Aug 2019 03:01:18 -0700 Subject: [PATCH] nvme: fix WRITE_TO_RO_RANGE status code WRITE_TO_RO_PAGE was incorrect and misleading. This 0x82 NVMe status code indicates a write to a read-only range of LBAs. So modify the constant name and associated usages to use WRITE_TO_RO_RANGE instead. Signed-off-by: Jim Harris Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465083 (master) (cherry picked from commit 0aa72ffb7451b51154629d4c012de338d8bd0386) Change-Id: I993dbebb5acc2e685a0e99aa14084942ef79d659 Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467133 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- include/spdk/nvme_spec.h | 2 +- lib/bdev/scsi_nvme.c | 2 +- lib/nvme/nvme_qpair.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/spdk/nvme_spec.h b/include/spdk/nvme_spec.h index fbb4d7448b..f06931abf9 100644 --- a/include/spdk/nvme_spec.h +++ b/include/spdk/nvme_spec.h @@ -654,7 +654,7 @@ enum spdk_nvme_command_specific_status_code { SPDK_NVME_SC_CONFLICTING_ATTRIBUTES = 0x80, SPDK_NVME_SC_INVALID_PROTECTION_INFO = 0x81, - SPDK_NVME_SC_ATTEMPTED_WRITE_TO_RO_PAGE = 0x82, + SPDK_NVME_SC_ATTEMPTED_WRITE_TO_RO_RANGE = 0x82, }; /** diff --git a/lib/bdev/scsi_nvme.c b/lib/bdev/scsi_nvme.c index 385b9036fe..8806161457 100644 --- a/lib/bdev/scsi_nvme.c +++ b/lib/bdev/scsi_nvme.c @@ -158,7 +158,7 @@ spdk_scsi_nvme_translate(const struct spdk_bdev_io *bdev_io, int *sc, int *sk, *asc = SPDK_SCSI_ASC_INVALID_FIELD_IN_CDB; *ascq = SPDK_SCSI_ASCQ_CAUSE_NOT_REPORTABLE; break; - case SPDK_NVME_SC_ATTEMPTED_WRITE_TO_RO_PAGE: + case SPDK_NVME_SC_ATTEMPTED_WRITE_TO_RO_RANGE: *sc = SPDK_SCSI_STATUS_CHECK_CONDITION; *sk = SPDK_SCSI_SENSE_DATA_PROTECT; *asc = SPDK_SCSI_ASC_WRITE_PROTECTED; diff --git a/lib/nvme/nvme_qpair.c b/lib/nvme/nvme_qpair.c index 97eb23de95..261e341530 100644 --- a/lib/nvme/nvme_qpair.c +++ b/lib/nvme/nvme_qpair.c @@ -239,7 +239,7 @@ static const struct nvme_string command_specific_status[] = { { SPDK_NVME_SC_INVALID_RESOURCE_ID, "INVALID RESOURCE IDENTIFIER" }, { SPDK_NVME_SC_CONFLICTING_ATTRIBUTES, "CONFLICTING ATTRIBUTES" }, { SPDK_NVME_SC_INVALID_PROTECTION_INFO, "INVALID PROTECTION INFO" }, - { SPDK_NVME_SC_ATTEMPTED_WRITE_TO_RO_PAGE, "WRITE TO RO PAGE" }, + { SPDK_NVME_SC_ATTEMPTED_WRITE_TO_RO_RANGE, "WRITE TO RO RANGE" }, { 0xFFFF, "COMMAND SPECIFIC" } };