From: Mike Snitzer <[email protected]>

nvme: Return BLK_STS_TARGET if the DNR bit is set

BZ: 1948690
Upstream Status: RHEL-only

Signed-off-by: Mike Snitzer <[email protected]>

rhel-8.git commit ef4ab90c12db5e0e50800ec323736b95be7a6ff5
Author: Mike Snitzer <[email protected]>
Date:   Tue Aug 25 21:52:45 2020 -0400

    [nvme] nvme: Return BLK_STS_TARGET if the DNR bit is set
    
    Message-id: <[email protected]>
    Patchwork-id: 325178
    Patchwork-instance: patchwork
    O-Subject: [RHEL8.3 PATCH 07/10] nvme: Return BLK_STS_TARGET if the DNR bit 
is set
    Bugzilla: 1843515
    RH-Acked-by: David Milburn <[email protected]>
    RH-Acked-by: Gopal Tiwari <[email protected]>
    RH-Acked-by: Ewan Milne <[email protected]>
    
    BZ: 1843515
    Upstream Status: RHEL-only
    
    If the DNR bit is set we should not retry the command, even if
    the standard status evaluation indicates so.
    
    SUSE is carrying this patch in their kernel:
    https://lwn.net/Articles/800370/
    
    Based on patch posted for upstream inclusion but rejected:
    v1: https://lore.kernel.org/linux-nvme/[email protected]/
    v2: https://lore.kernel.org/linux-nvme/[email protected]/
    v2-keith: 
https://lore.kernel.org/linux-nvme/[email protected]/
    v3: https://lore.kernel.org/linux-nvme/[email protected]/
    v3-keith: 
https://lore.kernel.org/linux-nvme/[email protected]/
    
    This commit's change is basically "v3-keith".
    
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Frantisek Hrbata <[email protected]>


diff a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -237,6 +237,9 @@ static void nvme_delete_ctrl_sync(struct nvme_ctrl *ctrl)
 
 static blk_status_t nvme_error_status(u16 status)
 {
+       if (unlikely(status & NVME_SC_DNR))
+               return BLK_STS_TARGET;
+
        switch (status & 0x7ff) {
        case NVME_SC_SUCCESS:
                return BLK_STS_OK;

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1024
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to