OSDN Git Service

nvme: skip optional id ctrl csi if it failed
authorKeith Busch <kbusch@kernel.org>
Tue, 30 May 2023 15:18:20 +0000 (08:18 -0700)
committerKeith Busch <kbusch@kernel.org>
Tue, 13 Jun 2023 01:24:15 +0000 (18:24 -0700)
A frequently recieved report is the driver requests the optional Command
Set Specific Identify Controller structure. Some controllers report this
in their error log, which tiggers other warnings to user space
monitoring the devices.

These error entries are harmless and of questionable value to save in
the log, but let's reduce their occurance by not resending the command
if it previously failed. This will not prevent the errors on the initial
module load, but will greatly reduce their occurance on any rescans and
resumes from suspend.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=217445
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/core.c
drivers/nvme/host/nvme.h

index afd2e4a..76e8f8b 100644 (file)
@@ -2995,7 +2995,8 @@ static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl)
                ctrl->max_zeroes_sectors = 0;
 
        if (ctrl->subsys->subtype != NVME_NQN_NVME ||
-           nvme_ctrl_limited_cns(ctrl))
+           nvme_ctrl_limited_cns(ctrl) ||
+           test_bit(NVME_CTRL_SKIP_ID_CNS_CS, &ctrl->flags))
                return 0;
 
        id = kzalloc(sizeof(*id), GFP_KERNEL);
@@ -3017,6 +3018,8 @@ static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl)
                ctrl->max_zeroes_sectors = nvme_mps_to_sectors(ctrl, id->wzsl);
 
 free_data:
+       if (ret > 0)
+               set_bit(NVME_CTRL_SKIP_ID_CNS_CS, &ctrl->flags);
        kfree(id);
        return ret;
 }
index 03cc752..78308f1 100644 (file)
@@ -242,6 +242,7 @@ enum nvme_ctrl_flags {
        NVME_CTRL_ADMIN_Q_STOPPED       = 1,
        NVME_CTRL_STARTED_ONCE          = 2,
        NVME_CTRL_STOPPED               = 3,
+       NVME_CTRL_SKIP_ID_CNS_CS        = 4,
 };
 
 struct nvme_ctrl {