Skip to content

Commit 8ae44c1

Browse files
Christoph Hellwigmehmetb0
authored andcommitted
nvme: don't apply NVME_QUIRK_DEALLOCATE_ZEROES when DSM is not supported
BugLink: https://bugs.launchpad.net/bugs/2096827 [ 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]> Signed-off-by: Koichiro Den <[email protected]>
1 parent 967f8fe commit 8ae44c1

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
@@ -2057,7 +2057,8 @@ static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id,
20572057
lim->physical_block_size = min(phys_bs, atomic_bs);
20582058
lim->io_min = phys_bs;
20592059
lim->io_opt = io_opt;
2060-
if (ns->ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES)
2060+
if ((ns->ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES) &&
2061+
(ns->ctrl->oncs & NVME_CTRL_ONCS_DSM))
20612062
lim->max_write_zeroes_sectors = UINT_MAX;
20622063
else
20632064
lim->max_write_zeroes_sectors = ns->ctrl->max_zeroes_sectors;

0 commit comments

Comments
 (0)