Skip to content

Commit 58a0c87

Browse files
Christoph Hellwigkeithbusch
authored andcommitted
nvme: don't apply NVME_QUIRK_DEALLOCATE_ZEROES when DSM is not supported
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]>
1 parent 84909f7 commit 58a0c87

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
@@ -2043,7 +2043,8 @@ static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id,
20432043
lim->physical_block_size = min(phys_bs, atomic_bs);
20442044
lim->io_min = phys_bs;
20452045
lim->io_opt = io_opt;
2046-
if (ns->ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES)
2046+
if ((ns->ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES) &&
2047+
(ns->ctrl->oncs & NVME_CTRL_ONCS_DSM))
20472048
lim->max_write_zeroes_sectors = UINT_MAX;
20482049
else
20492050
lim->max_write_zeroes_sectors = ns->ctrl->max_zeroes_sectors;

0 commit comments

Comments
 (0)