Skip to content

Commit 00636e8

Browse files
Christoph HellwigSasha Levin
authored andcommitted
nvme: don't apply NVME_QUIRK_DEALLOCATE_ZEROES when DSM is not supported
[ Upstream commit 58a0c87 ] Commit 63dfa10 ("nvme: move NVME_QUIRK_DEALLOCATE_ZEROES out of nvme_config_discard") started applying the NVME_QUIRK_DEALLOCATE_ZEROES quirk even then the Dataset Management is not supported. It turns out that there versions of these old Intel SSDs that have DSM support disabled in the firmware, which will now lead to errors everytime a Write Zeroes command is issued. Fix this by checking for DSM support before applying the quirk. Reported-by: Saeed Mirzamohammadi <[email protected]> Fixes: 63dfa10 ("nvme: move NVME_QUIRK_DEALLOCATE_ZEROES out of nvme_config_discard") Tested-by: Saeed Mirzamohammadi <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Nitesh Shetty <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Keith Busch <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent cce4531 commit 00636e8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/nvme/host/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2064,7 +2064,8 @@ static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id,
20642064
lim->physical_block_size = min(phys_bs, atomic_bs);
20652065
lim->io_min = phys_bs;
20662066
lim->io_opt = io_opt;
2067-
if (ns->ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES)
2067+
if ((ns->ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES) &&
2068+
(ns->ctrl->oncs & NVME_CTRL_ONCS_DSM))
20682069
lim->max_write_zeroes_sectors = UINT_MAX;
20692070
else
20702071
lim->max_write_zeroes_sectors = ns->ctrl->max_zeroes_sectors;

0 commit comments

Comments
 (0)