nvme: check hw sectors before setting chunk sectors
authorKeith Busch <keith.busch@intel.com>
Thu, 14 Dec 2017 18:20:14 +0000 (11:20 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Mar 2018 09:23:20 +0000 (10:23 +0100)
commitd4ea6118d3e36ea87b02607aea8f173b4c69f808
treed39e6dbc0d3adaa14828295099b05460e66a02c3
parent051337a8993a5481046209ec167eb6e821b6d922
nvme: check hw sectors before setting chunk sectors

[ Upstream commit 249159c5f15812140fa216f9997d799ac0023a1f ]

Some devices with IDs matching the "stripe" quirk don't actually have
this quirk, and don't have an MDTS value. When MDTS is not set, the
driver sets the max sectors to UINT_MAX, which is not a power of 2,
hitting a BUG_ON from blk_queue_chunk_sectors. This patch skips setting
chunk sectors for such devices.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvme/host/core.c