diff options
author | Noam Gottlieb <ngottlieb@nvidia.com> | 2021-06-07 12:23:22 +0300 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2021-06-17 16:51:19 +0300 |
commit | 7ae023c5aa644211bde26db11018fe08b8408bd5 (patch) | |
tree | d0b33f08cfd31fe77c429d2b1050148efa6779e2 /drivers/nvme/target/admin-cmd.c | |
parent | e13b061589ace0aee18bdbf86f3ddb2b6b5b5ab8 (diff) | |
download | linux-7ae023c5aa644211bde26db11018fe08b8408bd5.tar.xz |
nvmet: make sn stable once connection was established
Once some host has connected to the target, make sure that the serial
number is stable and cannot be changed.
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: Noam Gottlieb <ngottlieb@nvidia.com>
Signed-off-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, 6 insertions, 0 deletions
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c index 9c73dbfb8228..5f15c3285a5b 100644 --- a/drivers/nvme/target/admin-cmd.c +++ b/drivers/nvme/target/admin-cmd.c @@ -337,6 +337,12 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req) u32 cmd_capsule_size; u16 status = 0; + if (!subsys->subsys_discovered) { + mutex_lock(&subsys->lock); + subsys->subsys_discovered = true; + mutex_unlock(&subsys->lock); + } + /* * If there is no model number yet, set it now. It will then remain * stable for the life time of the subsystem. |