aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/nvme.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew.r.wilcox@intel.com>2011-05-20 09:34:43 -0400
committerMatthew Wilcox <matthew.r.wilcox@intel.com>2011-11-04 15:53:03 -0400
commiteac623ba7a91474a688eb5d0fcd0eaa6a56dc41c (patch)
tree59a355c616c3f8b717e73aac01af2f9e3ffdc60c /drivers/block/nvme.c
parent6f0f54499f2edf7e25410cdd99e6f030f3485fd1 (diff)
NVMe: Add the nvme thread to the wait queue before waking it up
If the I/O was not completed by a single NVMe command, we add the bio to the congestion list and wake up the kthread to resubmit it. But the kthread calls remove_wait_queue() unconditionally, which will oops if it's not on the wait queue. So add the kthread to the wait queue before waking it up. Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block/nvme.c')
-rw-r--r--drivers/block/nvme.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
index 843edbd79c56..f5e51a6116e3 100644
--- a/drivers/block/nvme.c
+++ b/drivers/block/nvme.c
@@ -325,6 +325,8 @@ static void bio_completion(struct nvme_queue *nvmeq, void *ctx,
325 if (status) { 325 if (status) {
326 bio_endio(bio, -EIO); 326 bio_endio(bio, -EIO);
327 } else if (bio->bi_vcnt > bio->bi_idx) { 327 } else if (bio->bi_vcnt > bio->bi_idx) {
328 if (bio_list_empty(&nvmeq->sq_cong))
329 add_wait_queue(&nvmeq->sq_full, &nvmeq->sq_cong_wait);
328 bio_list_add(&nvmeq->sq_cong, bio); 330 bio_list_add(&nvmeq->sq_cong, bio);
329 wake_up_process(nvme_thread); 331 wake_up_process(nvme_thread);
330 } else { 332 } else {