[PATCH] nvmet: make 'tsas' attribute idempotent for RDMA

Hannes Reinecke hare at kernel.org
Fri Jun 14 03:44:45 PDT 2024


The RDMA transport defines values for TSAS, but it cannot be changed.
To avoid errors during reconfiguration allow to write the current
value.

Fixes: 3f123494db72 ("nvmet: make TCP sectype settable via configfs")

Signed-off-by: Hannes Reinecke <hare at kernel.org>
---
 drivers/nvme/target/configfs.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index e60224356048..7dce276464a6 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -424,6 +424,17 @@ static ssize_t nvmet_addr_tsas_store(struct config_item *item,
 	if (nvmet_is_port_enabled(port, __func__))
 		return -EACCES;
 
+	if (port->disc_addr.trtype == NVMF_TRTYPE_RDMA) {
+		for (i = 0; i < ARRAY_SIZE(nvmet_addr_tsas_rdma); i++) {
+			u8 qptype;
+
+			if (sysfs_streq(page, nvmet_addr_tsas_rdma[i].name)) {
+				qptype = nvmet_addr_tsas_rdma[i].type;
+				if (qptype == port->disc_addr.tsas.rdma.qptype)
+					return count;
+			}
+		}
+	}
 	if (port->disc_addr.trtype != NVMF_TRTYPE_TCP)
 		return -EINVAL;
 
-- 
2.35.3




More information about the Linux-nvme mailing list