nvme: disable namespace access for unsupported metadata
authorKeith Busch <kbusch@kernel.org>
Tue, 30 Nov 2021 16:14:54 +0000 (08:14 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:24:00 +0000 (14:24 +0200)
commit92a6233585dce8be03becc587582e5abdc10071c
tree75879f875f58d8e40089fbe68e178ae610d8c99e
parent52cd55a4fb2df2397ea7b63d4329ef8d3259620c
nvme: disable namespace access for unsupported metadata

[ Upstream commit d39ad2a45c0e38def3e0c95f5b90d9af4274c939 ]

The only fabrics target that supports metadata handling through the
separate integrity buffer is RDMA. It is currently usable only if the
size is 8B per block and formatted for protection information. If an
rdma target were to export a namespace with a different format (ex:
4k+64B), the driver will not be able to submit valid read/write commands
for that namespace.

Suppress setting the metadata feature in the namespace so that the
gendisk capacity will be set to 0. This will prevent read/write access
through the block stack, but will continue to allow ioctl passthrough
commands.

Cc: Max Gurtovoy <mgurtovoy@nvidia.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/core.c