summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorSam Bradshaw <sbradshaw@micron.com>2014-07-29 13:31:36 -0700
committerJens Axboe <axboe@fb.com>2014-11-04 13:17:08 -0700
commit5905535610fc6b11379a999ff45bfa39f0d605b6 (patch)
tree53ab6a05b536836a31365822a6bd319b4fc00714 /drivers/block
parent302c6727e5eb4d0be0e02d077b65feb3e73ea254 (diff)
downloadlinux-5905535610fc6b11379a999ff45bfa39f0d605b6.tar.gz
linux-5905535610fc6b11379a999ff45bfa39f0d605b6.tar.bz2
linux-5905535610fc6b11379a999ff45bfa39f0d605b6.zip
NVMe: Correctly handle IOCTL_SUBMIT_IO when cpus > online queues
nvme_submit_io_cmd() uses smp_processor_id() to pick an IO queue index. This patch fixes the case where there are more cpus from which the ioctl call can originate than online queues, which can happen when a device supports or was allocated fewer interrupt vectors than exist cpu cores. Thanks to Keith Busch for the implementation suggestion. Signed-off-by: Sam Bradshaw <sbradshaw@micron.com> Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/nvme-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 48a1be4ab24c..5d44c9344522 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -984,8 +984,8 @@ int nvme_submit_admin_cmd(struct nvme_dev *dev, struct nvme_command *cmd,
int nvme_submit_io_cmd(struct nvme_dev *dev, struct nvme_command *cmd,
u32 *result)
{
- return nvme_submit_sync_cmd(dev, smp_processor_id() + 1, cmd, result,
- NVME_IO_TIMEOUT);
+ return nvme_submit_sync_cmd(dev, this_cpu_read(*dev->io_queue), cmd,
+ result, NVME_IO_TIMEOUT);
}
static int nvme_submit_admin_cmd_async(struct nvme_dev *dev,