nvme: simplify error logic in nvme_validate_ns()
authorHannes Reinecke <hare@suse.de>
Fri, 26 Feb 2021 07:17:25 +0000 (08:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Mar 2021 12:31:51 +0000 (14:31 +0200)
commitd8b17df7bf8052dbdb1503e9066899e679d3bb2d
tree613375d9816f1ec307ed260203ebde508d4723bc
parentb91230a0013f8a80192be6f0d77bcb89142eff32
nvme: simplify error logic in nvme_validate_ns()

[ Upstream commit d95c1f4179a7f3ea8aa728ed00252a8ed0f8158f ]

We only should remove namespaces when we get fatal error back from
the device or when the namespace IDs have changed.
So instead of painfully masking out error numbers which might indicate
that the error should be ignored we could use an NVME status code
to indicated when the namespace should be removed.
That simplifies the final logic and makes it less error-prone.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/core.c