Merge tag 'block-6.2-2023-01-27' of git://git.kernel.dk/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 28 Jan 2023 00:16:57 +0000 (16:16 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 28 Jan 2023 00:16:57 +0000 (16:16 -0800)
Pull block fixes from Jens Axboe:
 "Minor tweaks for this release:

   - NVMe pull request via Christoph:
        - Flush initial scan_work for async probe (Keith Busch)
        - Fix passthrough csi check (Keith Busch)
        - Fix nvme-fc initialization order (Ross Lagerwall)

   - Fix for tearing down non-started device in ublk (Ming)"

* tag 'block-6.2-2023-01-27' of git://git.kernel.dk/linux:
  block: ublk: move ublk_chr_class destroying after devices are removed
  nvme: fix passthrough csi check
  nvme-pci: flush initial scan_work for async probe
  nvme-fc: fix initialization order

1  2 
drivers/nvme/host/core.c

diff --combined drivers/nvme/host/core.c
index 7be562a4e1aa72d6278f657a24730afabb47aee8,2990ed331a1aa8bf438effb22d0e8afbbbc295fa..505e16f20e57fac0b866adf0ea0b6fe6b7d06118
@@@ -1093,7 -1093,7 +1093,7 @@@ u32 nvme_command_effects(struct nvme_ct
        if (ns) {
                if (ns->head->effects)
                        effects = le32_to_cpu(ns->head->effects->iocs[opcode]);
-               if (ns->head->ids.csi == NVME_CAP_CSS_NVM)
+               if (ns->head->ids.csi == NVME_CSI_NVM)
                        effects |= nvme_known_nvm_effects(opcode);
                if (effects & ~(NVME_CMD_EFFECTS_CSUPP | NVME_CMD_EFFECTS_LBCC))
                        dev_warn_once(ctrl->device,
@@@ -2137,34 -2137,11 +2137,34 @@@ static int nvme_send_ns_pr_command(stru
        return nvme_submit_sync_cmd(ns->queue, c, data, 16);
  }
  
 +static int nvme_sc_to_pr_err(int nvme_sc)
 +{
 +      if (nvme_is_path_error(nvme_sc))
 +              return PR_STS_PATH_FAILED;
 +
 +      switch (nvme_sc) {
 +      case NVME_SC_SUCCESS:
 +              return PR_STS_SUCCESS;
 +      case NVME_SC_RESERVATION_CONFLICT:
 +              return PR_STS_RESERVATION_CONFLICT;
 +      case NVME_SC_ONCS_NOT_SUPPORTED:
 +              return -EOPNOTSUPP;
 +      case NVME_SC_BAD_ATTRIBUTES:
 +      case NVME_SC_INVALID_OPCODE:
 +      case NVME_SC_INVALID_FIELD:
 +      case NVME_SC_INVALID_NS:
 +              return -EINVAL;
 +      default:
 +              return PR_STS_IOERR;
 +      }
 +}
 +
  static int nvme_pr_command(struct block_device *bdev, u32 cdw10,
                                u64 key, u64 sa_key, u8 op)
  {
        struct nvme_command c = { };
        u8 data[16] = { 0, };
 +      int ret;
  
        put_unaligned_le64(key, &data[0]);
        put_unaligned_le64(sa_key, &data[8]);
  
        if (IS_ENABLED(CONFIG_NVME_MULTIPATH) &&
            bdev->bd_disk->fops == &nvme_ns_head_ops)
 -              return nvme_send_ns_head_pr_command(bdev, &c, data);
 -      return nvme_send_ns_pr_command(bdev->bd_disk->private_data, &c, data);
 +              ret = nvme_send_ns_head_pr_command(bdev, &c, data);
 +      else
 +              ret = nvme_send_ns_pr_command(bdev->bd_disk->private_data, &c,
 +                                            data);
 +      if (ret < 0)
 +              return ret;
 +
 +      return nvme_sc_to_pr_err(ret);
  }
  
  static int nvme_pr_register(struct block_device *bdev, u64 old,
@@@ -4648,9 -4619,9 +4648,9 @@@ void nvme_remove_namespaces(struct nvme
  }
  EXPORT_SYMBOL_GPL(nvme_remove_namespaces);
  
 -static int nvme_class_uevent(struct device *dev, struct kobj_uevent_env *env)
 +static int nvme_class_uevent(const struct device *dev, struct kobj_uevent_env *env)
  {
 -      struct nvme_ctrl *ctrl =
 +      const struct nvme_ctrl *ctrl =
                container_of(dev, struct nvme_ctrl, ctrl_device);
        struct nvmf_ctrl_options *opts = ctrl->opts;
        int ret;