All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Provide a stable serial number
@ 2017-07-14 12:53 ` Johannes Thumshirn
  0 siblings, 0 replies; 16+ messages in thread
From: Johannes Thumshirn @ 2017-07-14 12:53 UTC (permalink / raw)
  To: Christoph Hellwig, Sagi Grimberg, Keith Busch
  Cc: Linux Kernel Mailinglist, Linux NVMe Mailinglist, Johannes Thumshirn

This pathset is a follow up to
http://lists.infradead.org/pipermail/linux-nvme/2017-July/011934.html.

The 1st patch moves the serial attribute from the contrller to the subsystem,
while the 2nd patch makes it configurable via configfs.

Changes to v2:
* Add attr_ prefix to version (Christoph)
* Re-add random serial comment(Christoph)

Changes to v1:
* Move generation of random serial to nvmet_subsys_alloc() (Christoph)

Johannes Thumshirn (3):
  nvmet: prefix version configfs file with attr
  nvmet: Move serial number from controller to subsystem
  nvmet: preserve controller serial number between reboots

 drivers/nvme/target/admin-cmd.c |  2 +-
 drivers/nvme/target/configfs.c  | 30 ++++++++++++++++++++++++++----
 drivers/nvme/target/core.c      |  7 ++++---
 drivers/nvme/target/nvmet.h     |  2 +-
 4 files changed, 32 insertions(+), 9 deletions(-)

-- 
2.12.3

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

* [PATCH v3 0/3] Provide a stable serial number
@ 2017-07-14 12:53 ` Johannes Thumshirn
  0 siblings, 0 replies; 16+ messages in thread
From: Johannes Thumshirn @ 2017-07-14 12:53 UTC (permalink / raw)


This pathset is a follow up to
http://lists.infradead.org/pipermail/linux-nvme/2017-July/011934.html.

The 1st patch moves the serial attribute from the contrller to the subsystem,
while the 2nd patch makes it configurable via configfs.

Changes to v2:
* Add attr_ prefix to version (Christoph)
* Re-add random serial comment(Christoph)

Changes to v1:
* Move generation of random serial to nvmet_subsys_alloc() (Christoph)

Johannes Thumshirn (3):
  nvmet: prefix version configfs file with attr
  nvmet: Move serial number from controller to subsystem
  nvmet: preserve controller serial number between reboots

 drivers/nvme/target/admin-cmd.c |  2 +-
 drivers/nvme/target/configfs.c  | 30 ++++++++++++++++++++++++++----
 drivers/nvme/target/core.c      |  7 ++++---
 drivers/nvme/target/nvmet.h     |  2 +-
 4 files changed, 32 insertions(+), 9 deletions(-)

-- 
2.12.3

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

* [PATCH v3 1/3] nvmet: prefix version configfs file with attr
  2017-07-14 12:53 ` Johannes Thumshirn
@ 2017-07-14 12:53   ` Johannes Thumshirn
  -1 siblings, 0 replies; 16+ messages in thread
From: Johannes Thumshirn @ 2017-07-14 12:53 UTC (permalink / raw)
  To: Christoph Hellwig, Sagi Grimberg, Keith Busch
  Cc: Linux Kernel Mailinglist, Linux NVMe Mailinglist, Johannes Thumshirn

The NVMe target's attribute files need an attr prefix in order to have
nvmetcli recognize them. Add this attribute.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/nvme/target/configfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index a358ecd93e11..ceee57bb0c24 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -650,7 +650,7 @@ static ssize_t nvmet_subsys_attr_allow_any_host_store(struct config_item *item,
 
 CONFIGFS_ATTR(nvmet_subsys_, attr_allow_any_host);
 
-static ssize_t nvmet_subsys_version_show(struct config_item *item,
+static ssize_t nvmet_subsys_attr_version_show(struct config_item *item,
 					      char *page)
 {
 	struct nvmet_subsys *subsys = to_subsys(item);
@@ -666,7 +666,7 @@ static ssize_t nvmet_subsys_version_show(struct config_item *item,
 				(int)NVME_MINOR(subsys->ver));
 }
 
-static ssize_t nvmet_subsys_version_store(struct config_item *item,
+static ssize_t nvmet_subsys_attr_version_store(struct config_item *item,
 					       const char *page, size_t count)
 {
 	struct nvmet_subsys *subsys = to_subsys(item);
@@ -684,11 +684,11 @@ static ssize_t nvmet_subsys_version_store(struct config_item *item,
 
 	return count;
 }
-CONFIGFS_ATTR(nvmet_subsys_, version);
+CONFIGFS_ATTR(nvmet_subsys_, attr_version);
 
 static struct configfs_attribute *nvmet_subsys_attrs[] = {
 	&nvmet_subsys_attr_attr_allow_any_host,
-	&nvmet_subsys_attr_version,
+	&nvmet_subsys_attr_attr_version,
 	NULL,
 };
 
-- 
2.12.3

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

* [PATCH v3 1/3] nvmet: prefix version configfs file with attr
@ 2017-07-14 12:53   ` Johannes Thumshirn
  0 siblings, 0 replies; 16+ messages in thread
From: Johannes Thumshirn @ 2017-07-14 12:53 UTC (permalink / raw)


The NVMe target's attribute files need an attr prefix in order to have
nvmetcli recognize them. Add this attribute.

Signed-off-by: Johannes Thumshirn <jthumshirn at suse.de>
---
 drivers/nvme/target/configfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index a358ecd93e11..ceee57bb0c24 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -650,7 +650,7 @@ static ssize_t nvmet_subsys_attr_allow_any_host_store(struct config_item *item,
 
 CONFIGFS_ATTR(nvmet_subsys_, attr_allow_any_host);
 
-static ssize_t nvmet_subsys_version_show(struct config_item *item,
+static ssize_t nvmet_subsys_attr_version_show(struct config_item *item,
 					      char *page)
 {
 	struct nvmet_subsys *subsys = to_subsys(item);
@@ -666,7 +666,7 @@ static ssize_t nvmet_subsys_version_show(struct config_item *item,
 				(int)NVME_MINOR(subsys->ver));
 }
 
-static ssize_t nvmet_subsys_version_store(struct config_item *item,
+static ssize_t nvmet_subsys_attr_version_store(struct config_item *item,
 					       const char *page, size_t count)
 {
 	struct nvmet_subsys *subsys = to_subsys(item);
@@ -684,11 +684,11 @@ static ssize_t nvmet_subsys_version_store(struct config_item *item,
 
 	return count;
 }
-CONFIGFS_ATTR(nvmet_subsys_, version);
+CONFIGFS_ATTR(nvmet_subsys_, attr_version);
 
 static struct configfs_attribute *nvmet_subsys_attrs[] = {
 	&nvmet_subsys_attr_attr_allow_any_host,
-	&nvmet_subsys_attr_version,
+	&nvmet_subsys_attr_attr_version,
 	NULL,
 };
 
-- 
2.12.3

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

* [PATCH v3 2/3] nvmet: Move serial number from controller to subsystem
  2017-07-14 12:53 ` Johannes Thumshirn
@ 2017-07-14 12:53   ` Johannes Thumshirn
  -1 siblings, 0 replies; 16+ messages in thread
From: Johannes Thumshirn @ 2017-07-14 12:53 UTC (permalink / raw)
  To: Christoph Hellwig, Sagi Grimberg, Keith Busch
  Cc: Linux Kernel Mailinglist, Linux NVMe Mailinglist, Johannes Thumshirn

The NVMe specification defines the serial number as:

"Serial Number (SN): Contains the serial number for the NVM subsystem
that is assigned by the vendor as an ASCII string. Refer to section
7.10 for unique identifier requirements. Refer to section 1.5 for ASCII
string requirements"

So move it from the controller to the subsystem, where it belongs.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/nvme/target/admin-cmd.c | 2 +-
 drivers/nvme/target/core.c      | 5 ++---
 drivers/nvme/target/nvmet.h     | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 35f930db3c02..f7ba006d6a65 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -185,7 +185,7 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
 	id->ssvid = 0;
 
 	memset(id->sn, ' ', sizeof(id->sn));
-	snprintf(id->sn, sizeof(id->sn), "%llx", ctrl->serial);
+	snprintf(id->sn, sizeof(id->sn), "%llx", ctrl->subsys->serial);
 
 	memset(id->mn, ' ', sizeof(id->mn));
 	strncpy((char *)id->mn, "Linux", sizeof(id->mn));
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index b5b4ac103748..f4b02bb4a1a8 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -767,9 +767,6 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
 	memcpy(ctrl->subsysnqn, subsysnqn, NVMF_NQN_SIZE);
 	memcpy(ctrl->hostnqn, hostnqn, NVMF_NQN_SIZE);
 
-	/* generate a random serial number as our controllers are ephemeral: */
-	get_random_bytes(&ctrl->serial, sizeof(ctrl->serial));
-
 	kref_init(&ctrl->ref);
 	ctrl->subsys = subsys;
 
@@ -928,6 +925,8 @@ struct nvmet_subsys *nvmet_subsys_alloc(const char *subsysnqn,
 		return NULL;
 
 	subsys->ver = NVME_VS(1, 3, 0); /* NVMe 1.3.0 */
+	/* generate a random serial number as our controllers are ephemeral: */
+	get_random_bytes(&subsys->serial, sizeof(subsys->serial));
 
 	switch (type) {
 	case NVME_NQN_NVME:
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 747bbdb4f9c6..e3b244c7e443 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -112,7 +112,6 @@ struct nvmet_ctrl {
 
 	struct mutex		lock;
 	u64			cap;
-	u64			serial;
 	u32			cc;
 	u32			csts;
 
@@ -152,6 +151,7 @@ struct nvmet_subsys {
 	u16			max_qid;
 
 	u64			ver;
+	u64			serial;
 	char			*subsysnqn;
 
 	struct config_group	group;
-- 
2.12.3

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

* [PATCH v3 2/3] nvmet: Move serial number from controller to subsystem
@ 2017-07-14 12:53   ` Johannes Thumshirn
  0 siblings, 0 replies; 16+ messages in thread
From: Johannes Thumshirn @ 2017-07-14 12:53 UTC (permalink / raw)


The NVMe specification defines the serial number as:

"Serial Number (SN): Contains the serial number for the NVM subsystem
that is assigned by the vendor as an ASCII string. Refer to section
7.10 for unique identifier requirements. Refer to section 1.5 for ASCII
string requirements"

So move it from the controller to the subsystem, where it belongs.

Signed-off-by: Johannes Thumshirn <jthumshirn at suse.de>
---
 drivers/nvme/target/admin-cmd.c | 2 +-
 drivers/nvme/target/core.c      | 5 ++---
 drivers/nvme/target/nvmet.h     | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 35f930db3c02..f7ba006d6a65 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -185,7 +185,7 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
 	id->ssvid = 0;
 
 	memset(id->sn, ' ', sizeof(id->sn));
-	snprintf(id->sn, sizeof(id->sn), "%llx", ctrl->serial);
+	snprintf(id->sn, sizeof(id->sn), "%llx", ctrl->subsys->serial);
 
 	memset(id->mn, ' ', sizeof(id->mn));
 	strncpy((char *)id->mn, "Linux", sizeof(id->mn));
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index b5b4ac103748..f4b02bb4a1a8 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -767,9 +767,6 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
 	memcpy(ctrl->subsysnqn, subsysnqn, NVMF_NQN_SIZE);
 	memcpy(ctrl->hostnqn, hostnqn, NVMF_NQN_SIZE);
 
-	/* generate a random serial number as our controllers are ephemeral: */
-	get_random_bytes(&ctrl->serial, sizeof(ctrl->serial));
-
 	kref_init(&ctrl->ref);
 	ctrl->subsys = subsys;
 
@@ -928,6 +925,8 @@ struct nvmet_subsys *nvmet_subsys_alloc(const char *subsysnqn,
 		return NULL;
 
 	subsys->ver = NVME_VS(1, 3, 0); /* NVMe 1.3.0 */
+	/* generate a random serial number as our controllers are ephemeral: */
+	get_random_bytes(&subsys->serial, sizeof(subsys->serial));
 
 	switch (type) {
 	case NVME_NQN_NVME:
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 747bbdb4f9c6..e3b244c7e443 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -112,7 +112,6 @@ struct nvmet_ctrl {
 
 	struct mutex		lock;
 	u64			cap;
-	u64			serial;
 	u32			cc;
 	u32			csts;
 
@@ -152,6 +151,7 @@ struct nvmet_subsys {
 	u16			max_qid;
 
 	u64			ver;
+	u64			serial;
 	char			*subsysnqn;
 
 	struct config_group	group;
-- 
2.12.3

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

* [PATCH v3 3/3] nvmet: preserve controller serial number between reboots
  2017-07-14 12:53 ` Johannes Thumshirn
@ 2017-07-14 12:53   ` Johannes Thumshirn
  -1 siblings, 0 replies; 16+ messages in thread
From: Johannes Thumshirn @ 2017-07-14 12:53 UTC (permalink / raw)
  To: Christoph Hellwig, Sagi Grimberg, Keith Busch
  Cc: Linux Kernel Mailinglist, Linux NVMe Mailinglist, Johannes Thumshirn

The NVMe target has no way to preserve controller serial
IDs across reboots which breaks udev scripts doing
SYMLINK+="dev/disk/by-id/nvme-$env{ID_SERIAL}-part%n.

Export the randomly generated serial number via configfs and allow
setting of a serial via configfs to mitigate this breakage.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/nvme/target/configfs.c | 22 ++++++++++++++++++++++
 drivers/nvme/target/core.c     |  2 ++
 2 files changed, 24 insertions(+)

diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index ceee57bb0c24..0a0067e771f5 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -686,9 +686,31 @@ static ssize_t nvmet_subsys_attr_version_store(struct config_item *item,
 }
 CONFIGFS_ATTR(nvmet_subsys_, attr_version);
 
+static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item,
+					     char *page)
+{
+	struct nvmet_subsys *subsys = to_subsys(item);
+
+	return snprintf(page, PAGE_SIZE, "%llx\n", subsys->serial);
+}
+
+static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item,
+					      const char *page, size_t count)
+{
+	struct nvmet_subsys *subsys = to_subsys(item);
+
+	down_write(&nvmet_config_sem);
+	sscanf(page, "%llx\n", &subsys->serial);
+	up_write(&nvmet_config_sem);
+
+	return count;
+}
+CONFIGFS_ATTR(nvmet_subsys_, attr_serial);
+
 static struct configfs_attribute *nvmet_subsys_attrs[] = {
 	&nvmet_subsys_attr_attr_allow_any_host,
 	&nvmet_subsys_attr_attr_version,
+	&nvmet_subsys_attr_attr_serial,
 	NULL,
 };
 
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index f4b02bb4a1a8..60ff5a55c253 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -924,9 +924,11 @@ struct nvmet_subsys *nvmet_subsys_alloc(const char *subsysnqn,
 	if (!subsys)
 		return NULL;
 
+	down_write(&nvmet_config_sem);
 	subsys->ver = NVME_VS(1, 3, 0); /* NVMe 1.3.0 */
 	/* generate a random serial number as our controllers are ephemeral: */
 	get_random_bytes(&subsys->serial, sizeof(subsys->serial));
+	up_write(&nvmet_config_sem);
 
 	switch (type) {
 	case NVME_NQN_NVME:
-- 
2.12.3

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

* [PATCH v3 3/3] nvmet: preserve controller serial number between reboots
@ 2017-07-14 12:53   ` Johannes Thumshirn
  0 siblings, 0 replies; 16+ messages in thread
From: Johannes Thumshirn @ 2017-07-14 12:53 UTC (permalink / raw)


The NVMe target has no way to preserve controller serial
IDs across reboots which breaks udev scripts doing
SYMLINK+="dev/disk/by-id/nvme-$env{ID_SERIAL}-part%n.

Export the randomly generated serial number via configfs and allow
setting of a serial via configfs to mitigate this breakage.

Signed-off-by: Johannes Thumshirn <jthumshirn at suse.de>
---
 drivers/nvme/target/configfs.c | 22 ++++++++++++++++++++++
 drivers/nvme/target/core.c     |  2 ++
 2 files changed, 24 insertions(+)

diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index ceee57bb0c24..0a0067e771f5 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -686,9 +686,31 @@ static ssize_t nvmet_subsys_attr_version_store(struct config_item *item,
 }
 CONFIGFS_ATTR(nvmet_subsys_, attr_version);
 
+static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item,
+					     char *page)
+{
+	struct nvmet_subsys *subsys = to_subsys(item);
+
+	return snprintf(page, PAGE_SIZE, "%llx\n", subsys->serial);
+}
+
+static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item,
+					      const char *page, size_t count)
+{
+	struct nvmet_subsys *subsys = to_subsys(item);
+
+	down_write(&nvmet_config_sem);
+	sscanf(page, "%llx\n", &subsys->serial);
+	up_write(&nvmet_config_sem);
+
+	return count;
+}
+CONFIGFS_ATTR(nvmet_subsys_, attr_serial);
+
 static struct configfs_attribute *nvmet_subsys_attrs[] = {
 	&nvmet_subsys_attr_attr_allow_any_host,
 	&nvmet_subsys_attr_attr_version,
+	&nvmet_subsys_attr_attr_serial,
 	NULL,
 };
 
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index f4b02bb4a1a8..60ff5a55c253 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -924,9 +924,11 @@ struct nvmet_subsys *nvmet_subsys_alloc(const char *subsysnqn,
 	if (!subsys)
 		return NULL;
 
+	down_write(&nvmet_config_sem);
 	subsys->ver = NVME_VS(1, 3, 0); /* NVMe 1.3.0 */
 	/* generate a random serial number as our controllers are ephemeral: */
 	get_random_bytes(&subsys->serial, sizeof(subsys->serial));
+	up_write(&nvmet_config_sem);
 
 	switch (type) {
 	case NVME_NQN_NVME:
-- 
2.12.3

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

* Re: [PATCH v3 1/3] nvmet: prefix version configfs file with attr
  2017-07-14 12:53   ` Johannes Thumshirn
@ 2017-07-14 12:55     ` Christoph Hellwig
  -1 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2017-07-14 12:55 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Christoph Hellwig, Sagi Grimberg, Keith Busch,
	Linux Kernel Mailinglist, Linux NVMe Mailinglist

Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* [PATCH v3 1/3] nvmet: prefix version configfs file with attr
@ 2017-07-14 12:55     ` Christoph Hellwig
  0 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2017-07-14 12:55 UTC (permalink / raw)


Looks fine,

Reviewed-by: Christoph Hellwig <hch at lst.de>

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

* Re: [PATCH v3 2/3] nvmet: Move serial number from controller to subsystem
  2017-07-14 12:53   ` Johannes Thumshirn
@ 2017-07-14 12:55     ` Christoph Hellwig
  -1 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2017-07-14 12:55 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Christoph Hellwig, Sagi Grimberg, Keith Busch,
	Linux Kernel Mailinglist, Linux NVMe Mailinglist

Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* [PATCH v3 2/3] nvmet: Move serial number from controller to subsystem
@ 2017-07-14 12:55     ` Christoph Hellwig
  0 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2017-07-14 12:55 UTC (permalink / raw)


Looks fine,

Reviewed-by: Christoph Hellwig <hch at lst.de>

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

* Re: [PATCH v3 3/3] nvmet: preserve controller serial number between reboots
  2017-07-14 12:53   ` Johannes Thumshirn
@ 2017-07-14 12:56     ` Christoph Hellwig
  -1 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2017-07-14 12:56 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Christoph Hellwig, Sagi Grimberg, Keith Busch,
	Linux Kernel Mailinglist, Linux NVMe Mailinglist

> +	down_write(&nvmet_config_sem);
>  	subsys->ver = NVME_VS(1, 3, 0); /* NVMe 1.3.0 */
>  	/* generate a random serial number as our controllers are ephemeral: */
>  	get_random_bytes(&subsys->serial, sizeof(subsys->serial));
> +	up_write(&nvmet_config_sem);

no need for the lock here, the subsystems isn't visible at this point.

Otherwise:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* [PATCH v3 3/3] nvmet: preserve controller serial number between reboots
@ 2017-07-14 12:56     ` Christoph Hellwig
  0 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2017-07-14 12:56 UTC (permalink / raw)


> +	down_write(&nvmet_config_sem);
>  	subsys->ver = NVME_VS(1, 3, 0); /* NVMe 1.3.0 */
>  	/* generate a random serial number as our controllers are ephemeral: */
>  	get_random_bytes(&subsys->serial, sizeof(subsys->serial));
> +	up_write(&nvmet_config_sem);

no need for the lock here, the subsystems isn't visible at this point.

Otherwise:

Reviewed-by: Christoph Hellwig <hch at lst.de>

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

* Re: [PATCH v3 1/3] nvmet: prefix version configfs file with attr
  2017-07-14 12:53   ` Johannes Thumshirn
@ 2017-07-14 13:41     ` Hannes Reinecke
  -1 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2017-07-14 13:41 UTC (permalink / raw)
  To: Johannes Thumshirn, Christoph Hellwig, Sagi Grimberg, Keith Busch
  Cc: Linux Kernel Mailinglist, Linux NVMe Mailinglist

On 07/14/2017 02:53 PM, Johannes Thumshirn wrote:
> The NVMe target's attribute files need an attr prefix in order to have
> nvmetcli recognize them. Add this attribute.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
>  drivers/nvme/target/configfs.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
> index a358ecd93e11..ceee57bb0c24 100644
> --- a/drivers/nvme/target/configfs.c
> +++ b/drivers/nvme/target/configfs.c
> @@ -650,7 +650,7 @@ static ssize_t nvmet_subsys_attr_allow_any_host_store(struct config_item *item,
>  
>  CONFIGFS_ATTR(nvmet_subsys_, attr_allow_any_host);
>  
> -static ssize_t nvmet_subsys_version_show(struct config_item *item,
> +static ssize_t nvmet_subsys_attr_version_show(struct config_item *item,
>  					      char *page)
>  {
>  	struct nvmet_subsys *subsys = to_subsys(item);
> @@ -666,7 +666,7 @@ static ssize_t nvmet_subsys_version_show(struct config_item *item,
>  				(int)NVME_MINOR(subsys->ver));
>  }
>  
> -static ssize_t nvmet_subsys_version_store(struct config_item *item,
> +static ssize_t nvmet_subsys_attr_version_store(struct config_item *item,
>  					       const char *page, size_t count)
>  {
>  	struct nvmet_subsys *subsys = to_subsys(item);
> @@ -684,11 +684,11 @@ static ssize_t nvmet_subsys_version_store(struct config_item *item,
>  
>  	return count;
>  }
> -CONFIGFS_ATTR(nvmet_subsys_, version);
> +CONFIGFS_ATTR(nvmet_subsys_, attr_version);
>  
>  static struct configfs_attribute *nvmet_subsys_attrs[] = {
>  	&nvmet_subsys_attr_attr_allow_any_host,
> -	&nvmet_subsys_attr_version,
> +	&nvmet_subsys_attr_attr_version,
>  	NULL,
>  };
>  
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* [PATCH v3 1/3] nvmet: prefix version configfs file with attr
@ 2017-07-14 13:41     ` Hannes Reinecke
  0 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2017-07-14 13:41 UTC (permalink / raw)


On 07/14/2017 02:53 PM, Johannes Thumshirn wrote:
> The NVMe target's attribute files need an attr prefix in order to have
> nvmetcli recognize them. Add this attribute.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn at suse.de>
> ---
>  drivers/nvme/target/configfs.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
> index a358ecd93e11..ceee57bb0c24 100644
> --- a/drivers/nvme/target/configfs.c
> +++ b/drivers/nvme/target/configfs.c
> @@ -650,7 +650,7 @@ static ssize_t nvmet_subsys_attr_allow_any_host_store(struct config_item *item,
>  
>  CONFIGFS_ATTR(nvmet_subsys_, attr_allow_any_host);
>  
> -static ssize_t nvmet_subsys_version_show(struct config_item *item,
> +static ssize_t nvmet_subsys_attr_version_show(struct config_item *item,
>  					      char *page)
>  {
>  	struct nvmet_subsys *subsys = to_subsys(item);
> @@ -666,7 +666,7 @@ static ssize_t nvmet_subsys_version_show(struct config_item *item,
>  				(int)NVME_MINOR(subsys->ver));
>  }
>  
> -static ssize_t nvmet_subsys_version_store(struct config_item *item,
> +static ssize_t nvmet_subsys_attr_version_store(struct config_item *item,
>  					       const char *page, size_t count)
>  {
>  	struct nvmet_subsys *subsys = to_subsys(item);
> @@ -684,11 +684,11 @@ static ssize_t nvmet_subsys_version_store(struct config_item *item,
>  
>  	return count;
>  }
> -CONFIGFS_ATTR(nvmet_subsys_, version);
> +CONFIGFS_ATTR(nvmet_subsys_, attr_version);
>  
>  static struct configfs_attribute *nvmet_subsys_attrs[] = {
>  	&nvmet_subsys_attr_attr_allow_any_host,
> -	&nvmet_subsys_attr_version,
> +	&nvmet_subsys_attr_attr_version,
>  	NULL,
>  };
>  
> 
Reviewed-by: Hannes Reinecke <hare at suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare at suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: F. Imend?rffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG N?rnberg)

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

end of thread, other threads:[~2017-07-14 13:41 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-14 12:53 [PATCH v3 0/3] Provide a stable serial number Johannes Thumshirn
2017-07-14 12:53 ` Johannes Thumshirn
2017-07-14 12:53 ` [PATCH v3 1/3] nvmet: prefix version configfs file with attr Johannes Thumshirn
2017-07-14 12:53   ` Johannes Thumshirn
2017-07-14 12:55   ` Christoph Hellwig
2017-07-14 12:55     ` Christoph Hellwig
2017-07-14 13:41   ` Hannes Reinecke
2017-07-14 13:41     ` Hannes Reinecke
2017-07-14 12:53 ` [PATCH v3 2/3] nvmet: Move serial number from controller to subsystem Johannes Thumshirn
2017-07-14 12:53   ` Johannes Thumshirn
2017-07-14 12:55   ` Christoph Hellwig
2017-07-14 12:55     ` Christoph Hellwig
2017-07-14 12:53 ` [PATCH v3 3/3] nvmet: preserve controller serial number between reboots Johannes Thumshirn
2017-07-14 12:53   ` Johannes Thumshirn
2017-07-14 12:56   ` Christoph Hellwig
2017-07-14 12:56     ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.