diff options
author | Sagi Grimberg <sagi@grimberg.me> | 2016-08-04 11:18:49 +0300 |
---|---|---|
committer | Sagi Grimberg <sagi@grimberg.me> | 2016-08-04 17:45:10 +0300 |
commit | 28b89118539da03f4b188763e1b2fd1aec0f580a (patch) | |
tree | 2c004bc3fe811df5a1abf39771c82c9ef518c18c /drivers/nvme/target/admin-cmd.c | |
parent | 40e64e07213201710a51e270595d6e6c028f9502 (diff) | |
download | talos-op-linux-28b89118539da03f4b188763e1b2fd1aec0f580a.tar.gz talos-op-linux-28b89118539da03f4b188763e1b2fd1aec0f580a.zip |
nvmet: Fix controller serial number inconsistency
The host is allowed to issue identify as many times
as it wants, we need to stay consistent when reporting
the serial number for a given controller.
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme/target/admin-cmd.c')
-rw-r--r-- | drivers/nvme/target/admin-cmd.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c index 2fac17a5ad53..47c564b5a289 100644 --- a/drivers/nvme/target/admin-cmd.c +++ b/drivers/nvme/target/admin-cmd.c @@ -13,7 +13,6 @@ */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/module.h> -#include <linux/random.h> #include <generated/utsrelease.h> #include "nvmet.h" @@ -83,7 +82,6 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req) { struct nvmet_ctrl *ctrl = req->sq->ctrl; struct nvme_id_ctrl *id; - u64 serial; u16 status = 0; id = kzalloc(sizeof(*id), GFP_KERNEL); @@ -96,10 +94,8 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req) id->vid = 0; id->ssvid = 0; - /* generate a random serial number as our controllers are ephemeral: */ - get_random_bytes(&serial, sizeof(serial)); memset(id->sn, ' ', sizeof(id->sn)); - snprintf(id->sn, sizeof(id->sn), "%llx", serial); + snprintf(id->sn, sizeof(id->sn), "%llx", ctrl->serial); memset(id->mn, ' ', sizeof(id->mn)); strncpy((char *)id->mn, "Linux", sizeof(id->mn)); |