NVMe: IOCTL path RCU protect queue access
authorKeith Busch <keith.busch@intel.com>
Mon, 3 Mar 2014 23:39:13 +0000 (16:39 -0700)
committerMatthew Wilcox <matthew.r.wilcox@intel.com>
Mon, 24 Mar 2014 12:54:40 +0000 (08:54 -0400)
commit4f5099af4f3d5f999d8ab7784472d93e810e3912
treef0dc2bc897e723037ae63a5f7f41bb3bff710399
parent5a92e700af2e5e0e6404988d6a7f2ed3dad3f46f
NVMe: IOCTL path RCU protect queue access

This adds rcu protected access to a queue in the nvme IOCTL path
to fix potential races between a surprise removal and queue usage in
nvme_submit_sync_cmd. The fix holds the rcu_read_lock() here to prevent
the nvme_queue from freeing while this path is executing so it can't
sleep, and so this path will no longer wait for a available command
id should they all be in use at the time a passthrough IOCTL request
is received.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
drivers/block/nvme-core.c
drivers/block/nvme-scsi.c
include/linux/nvme.h