nvme: keep ctrl->namespaces ordered
authorChristoph Hellwig <hch@lst.de>
Tue, 14 Sep 2021 06:38:20 +0000 (08:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Sep 2021 08:11:04 +0000 (10:11 +0200)
commit215df4349916a62a03b1899ded08e7a9d2d40480
tree1d2f5e78063b21cba459b1650d637f33b6a2cce9
parent55e6f8b3c0f5cc600df12ddd0371d2703b910fd7
nvme: keep ctrl->namespaces ordered

[ Upstream commit 298ba0e3d4af539cc37f982d4c011a0f07fca48c ]

Various places in the nvme code that rely on ctrl->namespace to be
ordered.  Ensure that the namespae is inserted into the list at the
right position from the start instead of sorting it after the fact.

Fixes: 540c801c65eb ("NVMe: Implement namespace list scanning")
Reported-by: Anton Eidelman <anton.eidelman@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/core.c