nvme fixes for 5.9

- another quirk for the controller from hell (David Milburn)
  - fix a Kconfig dependency (Necip Fazil Yildiran)
  - char devices / passthrough refcount fixes (Chaitanya Kulkarni)
 -----BEGIN PGP SIGNATURE-----
 
 iQI/BAABCgApFiEEgdbnc3r/njty3Iq9D55TZVIEUYMFAl9jnBYLHGhjaEBsc3Qu
 ZGUACgkQD55TZVIEUYOyDg/8DDqW8EEbHGTE8ejJIDf46H9SguMnk1TEJRn2JhTV
 5VdihajC1k+VP9KcidmKHWa1p6Leh6hr2kPoD96ZwmMAIhR8EzhKQSVooYa9yt3f
 qksJI2QEs0JhS9YSfzuXQOaNQA4mi+MrwTxjaCKimu28aosQpS1Iz4UJRHvc2J4P
 PkTvHS3Lm6Ux6kLpLeLbtUncTVh0CDo41bZ9ojoLKFe6r5QRDZJCbacJxep/VzpQ
 NERfgHIGN5hHAAThEh4wYK8/m6KrcUGDpbssJbHwAa7bf3DG6lgGzCZzVNXKe/k0
 l/0v82ufgSdVqheyQ3vV7RnsdBZXlCG4NlbkCy7/ZV0/M0bDFAljuB6EDNJvj7bA
 xOTp6QQ3d8TPrtkUlqvdW1CDPWbC2qN5bj3hlekZ4ZeERpQA3EctL8/YRk1qyUec
 S+dXK+BqSAkWb2DQ8E+HnveTwyUni+frRSZpsSLPmbOpvCeMnEJphCO74ODZBuGO
 Jq84GSCOOERSPpgw/pjgLhPkBuYyQCmHCQsdYkO8s5vvOtFnXgAD/VtyEfrM1Br6
 atcU7VUqazrz5OsYSUH4kv4c5jTLXN24J/H3OlDSTR3x99FC3EQBhGQ0IyUIt4Jh
 h2gyAh5/ye7yasr7+axlUFOXHDd0e1tt5FaCbzGUPH84Ih0pB9oo43Qp6vS6PJP7
 7NQ=
 =VKz+
 -----END PGP SIGNATURE-----

Merge tag 'nvme-5.9-2020-09-17' of git://git.infradead.org/nvme into block-5.9

Pull NVMe fixes from Christoph:

"nvme fixes for 5.9

  - another quirk for the controller from hell (David Milburn)
  - fix a Kconfig dependency (Necip Fazil Yildiran)
  - char devices / passthrough refcount fixes (Chaitanya Kulkarni)"

* tag 'nvme-5.9-2020-09-17' of git://git.infradead.org/nvme:
  nvmet: get transport reference for passthru ctrl
  nvme-core: get/put ctrl and transport module in nvme_dev_open/release()
  nvme-tcp: fix kconfig dependency warning when !CRYPTO
  nvme-pci: disable the write zeros command for Intel 600P/P3100
This commit is contained in:
Jens Axboe 2020-09-17 11:49:44 -06:00
commit 4a2dd2c798
4 changed files with 20 additions and 1 deletions

View File

@ -73,6 +73,7 @@ config NVME_TCP
depends on INET
depends on BLK_DEV_NVME
select NVME_FABRICS
select CRYPTO
select CRYPTO_CRC32C
help
This provides support for the NVMe over Fabrics protocol using

View File

@ -3261,10 +3261,24 @@ static int nvme_dev_open(struct inode *inode, struct file *file)
return -EWOULDBLOCK;
}
nvme_get_ctrl(ctrl);
if (!try_module_get(ctrl->ops->module))
return -EINVAL;
file->private_data = ctrl;
return 0;
}
static int nvme_dev_release(struct inode *inode, struct file *file)
{
struct nvme_ctrl *ctrl =
container_of(inode->i_cdev, struct nvme_ctrl, cdev);
module_put(ctrl->ops->module);
nvme_put_ctrl(ctrl);
return 0;
}
static int nvme_dev_user_cmd(struct nvme_ctrl *ctrl, void __user *argp)
{
struct nvme_ns *ns;
@ -3327,6 +3341,7 @@ static long nvme_dev_ioctl(struct file *file, unsigned int cmd,
static const struct file_operations nvme_dev_fops = {
.owner = THIS_MODULE,
.open = nvme_dev_open,
.release = nvme_dev_release,
.unlocked_ioctl = nvme_dev_ioctl,
.compat_ioctl = compat_ptr_ioctl,
};

View File

@ -3153,7 +3153,8 @@ static const struct pci_device_id nvme_id_table[] = {
{ PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */
.driver_data = NVME_QUIRK_NO_DEEPEST_PS |
NVME_QUIRK_MEDIUM_PRIO_SQ |
NVME_QUIRK_NO_TEMP_THRESH_CHANGE },
NVME_QUIRK_NO_TEMP_THRESH_CHANGE |
NVME_QUIRK_DISABLE_WRITE_ZEROES, },
{ PCI_VDEVICE(INTEL, 0xf1a6), /* Intel 760p/Pro 7600p */
.driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
{ PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */

View File

@ -517,6 +517,7 @@ int nvmet_passthru_ctrl_enable(struct nvmet_subsys *subsys)
subsys->ver = NVME_VS(1, 2, 1);
}
__module_get(subsys->passthru_ctrl->ops->module);
mutex_unlock(&subsys->lock);
return 0;
@ -531,6 +532,7 @@ static void __nvmet_passthru_ctrl_disable(struct nvmet_subsys *subsys)
{
if (subsys->passthru_ctrl) {
xa_erase(&passthru_subsystems, subsys->passthru_ctrl->cntlid);
module_put(subsys->passthru_ctrl->ops->module);
nvme_put_ctrl(subsys->passthru_ctrl);
}
subsys->passthru_ctrl = NULL;