nvme: don't apply NVME_QUIRK_DEALLOCATE_ZEROES when DSM is not supported
Christoph Hellwig
maintainerPATCH 1/1 nvme: don't apply NVME_QUIRK_DEALLOCATE_ZEROES when DSM is not supported
Commit 63dfa1004322 ("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.
--- drivers/nvme/host/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +2 -1
@@ -2043,7 +2043,8 @@ static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id, lim->physical_block_size =min (phys_bs, atomic_bs); lim->io_min = phys_bs; lim->io_opt = io_opt; -if (ns->ctrl->quirks &NVME_QUIRK_DEALLOCATE_ZEROES ) +if ((ns->ctrl->quirks &NVME_QUIRK_DEALLOCATE_ZEROES ) && + (ns->ctrl->oncs &NVME_CTRL_ONCS_DSM )) lim->max_write_zeroes_sectors =UINT_MAX ;else lim->max_write_zeroes_sectors = ns->ctrl->max_zeroes_sectors;
Signature · 1 line
2.45.2
Quoted 8 lines · Christoph Hellwig
Commit
63dfa1004322("nvme: moveNVME_QUIRK_DEALLOCATE_ZEROESout ofnvme_config_discard") started applying theNVME_QUIRK_DEALLOCATE_ZEROESquirk 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.
Quoted 4 lines
Reported-by Saeed Mirzamohammadi<[email protected]>Fixes 63dfa1004322 ("nvme: move NVME_QUIRK_DEALLOCATE_ZEROES out of nvme_config_discard")Tested-by Saeed Mirzamohammadi<[email protected]>Signed-off-by Christoph Hellwig<[email protected]>
Looks good.
-ck
Keith Busch
maintainerQuoted 7 lines · Christoph Hellwig
Commit
63dfa1004322("nvme: moveNVME_QUIRK_DEALLOCATE_ZEROESout ofnvme_config_discard") started applying theNVME_QUIRK_DEALLOCATE_ZEROESquirk 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.
I still think this is wrong, and we should just remove the quirk for this device. With the exception to this firmware version, this device generally supports both discards and write zeroes. The only reason it added this quirk was because the quirk used to mean something completely different (specifically, it would set the "discard_zeroes_data" attribute that's no longer used). It didn't mean to prefer discards over write zeroes, but that's what it means now, and that's not what this drive wants.
Christoph Hellwig
maintainerQuoted 8 lines · Keith Busch
I still think this is wrong, and we should just remove the quirk for this device. With the exception to this firmware version, this device generally supports both discards and write zeroes. The only reason it added this quirk was because the quirk used to mean something completely different (specifically, it would set the "
discard_zeroes_data" attribute that's no longer used). It didn't mean to prefer discards over write zeroes, but that's what it means now, and that's not what this drive wants.
I'll have to trust you on this device, and certainly won't object removing this weirdo quick. But as long as we don't remove the quirk entirely we'll also need this fix. So I guess we should go for both?
Keith Busch
maintainerQuoted 10 lines · Christoph Hellwig
Quoted 8 lines · Keith Busch
I still think this is wrong, and we should just remove the quirk for this device. With the exception to this firmware version, this device generally supports both discards and write zeroes. The only reason it added this quirk was because the quirk used to mean something completely different (specifically, it would set the "
discard_zeroes_data" attribute that's no longer used). It didn't mean to prefer discards over write zeroes, but that's what it means now, and that's not what this drive wants.
Quoted 4 lines
I'll have to trust you on this device, and certainly won't object removing this weirdo quick. But as long as we don't remove the quirk entirely we'll also need this fix. So I guess we should go for both?
Sure, that sounds good to me.
Quoted 8 lines · Christoph Hellwig
Commit
63dfa1004322("nvme: moveNVME_QUIRK_DEALLOCATE_ZEROESout ofnvme_config_discard") started applying theNVME_QUIRK_DEALLOCATE_ZEROESquirk 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.
Quoted 5 lines
Reported-by Saeed Mirzamohammadi <[email protected]>Fixes 63dfa1004322 ("nvme: move NVME_QUIRK_DEALLOCATE_ZEROES out of nvme_config_discard")Tested-by Saeed Mirzamohammadi <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>---
Quoted 8 lines · Christoph Hellwig
Commit
63dfa1004322("nvme: moveNVME_QUIRK_DEALLOCATE_ZEROESout ofnvme_config_discard") started applying theNVME_QUIRK_DEALLOCATE_ZEROESquirk 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.
Quoted 4 lines
Reported-by Saeed Mirzamohammadi <[email protected]>Fixes 63dfa1004322 ("nvme: move NVME_QUIRK_DEALLOCATE_ZEROES out of nvme_config_discard")Tested-by Saeed Mirzamohammadi <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>
Thanks, applied to nvme-6.13.
Thanks! Can this be applied to 6.11+ stable releases as well since the broken commit is in 6.9.y?
Saeed
Quoted 17 lines · Keith Busch
Quoted 8 lines · Christoph Hellwig
Commit
63dfa1004322("nvme: moveNVME_QUIRK_DEALLOCATE_ZEROESout ofnvme_config_discard") started applying theNVME_QUIRK_DEALLOCATE_ZEROESquirk 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.Quoted 4 lines
Reported-by Saeed Mirzamohammadi <[email protected]>Fixes 63dfa1004322 ("nvme: move NVME_QUIRK_DEALLOCATE_ZEROES out of nvme_config_discard")Tested-by Saeed Mirzamohammadi <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>Thanks, applied to nvme-6.13.
Keith Busch
maintainerQuoted 1 line · Saeed Mirzamohammadi
Thanks! Can this be applied to 6.11+ stable releases as well since the broken commit is in 6.9.y?
I don't think it can go to 6.9.y because it is not an LTS and that branch appears to have already ended stable support.
Since this patch has the "Fixes" tag though, the stable auto patch selection should grab it for the appropriate stable branches that are still supported, so branches like 6.11.y and 6.6.y should get it. I'll keep an eye out for it after the next pull request just to make sure.