aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvme/host/nvme.h
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2016-02-24 09:15:54 -0700
committerJens Axboe <axboe@fb.com>2016-03-03 14:42:49 -0700
commit646017a612e72f19bd9f991fe25287a149c5f627 (patch)
treec8ff5e127118a4b6de68734be5a8e0560110debe /drivers/nvme/host/nvme.h
parentNVMe: Use IDA for namespace disk naming (diff)
downloadlinux-dev-646017a612e72f19bd9f991fe25287a149c5f627.tar.xz
linux-dev-646017a612e72f19bd9f991fe25287a149c5f627.zip
NVMe: Fix namespace removal deadlock
This patch makes nvme namespace removal lockless. It is up to the caller to ensure no active namespace scanning is occuring. To ensure no scan work occurs, the nvme pci driver adds a removing state to the controller device to avoid queueing scan work during removal. The work is flushed after setting the state, so no new scan work can be queued. The lockless removal allows the driver to cleanup a namespace request_queue if the controller fails during removal. Previously this could deadlock trying to acquire the namespace mutex in order to handle such events. Signed-off-by: Keith Busch <keith.busch@intel.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/nvme/host/nvme.h')
-rw-r--r--drivers/nvme/host/nvme.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 9407f2fa4487..4075fa9e0c34 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -114,6 +114,10 @@ struct nvme_ns {
bool ext;
u8 pi_type;
int type;
+ unsigned long flags;
+
+#define NVME_NS_REMOVING 0
+
u64 mode_select_num_blocks;
u32 mode_select_block_len;
};