]> git.baikalelectronics.ru Git - kernel.git/commit
nvme: fix handling single range discard request
authorMing Lei <ming.lei@redhat.com>
Fri, 3 Mar 2023 23:13:45 +0000 (07:13 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Mar 2023 12:33:47 +0000 (13:33 +0100)
commit057a9b617207b79ab60034bc6ebf4d8bf5bfdfaa
tree1290e30026ba953563d1bc2cf6c47337faf87cd4
parent24170376ece885185ee9e5e18f5bbb5ee32a0674
nvme: fix handling single range discard request

[ Upstream commit e3330553770d67f16059c5a8064ba80bf482293b ]

When investigating one customer report on warning in nvme_setup_discard,
we observed the controller(nvme/tcp) actually exposes
queue_max_discard_segments(req->q) == 1.

Obviously the current code can't handle this situation, since contiguity
merge like normal RW request is taken.

Fix the issue by building range from request sector/nr_sectors directly.

Fixes: 8673d5f203c4 ("nvme: support ranged discard requests")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/core.c