Skip to content

Commit

Permalink
NVMe: Add the nvme thread to the wait queue before waking it up
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matthew Wilcox committed Nov 4, 2011
1 parent 6f0f544 commit eac623b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/block/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ static void bio_completion(struct nvme_queue *nvmeq, void *ctx,
if (status) {
bio_endio(bio, -EIO);
} else if (bio->bi_vcnt > bio->bi_idx) {
if (bio_list_empty(&nvmeq->sq_cong))
add_wait_queue(&nvmeq->sq_full, &nvmeq->sq_cong_wait);
bio_list_add(&nvmeq->sq_cong, bio);
wake_up_process(nvme_thread);
} else {
Expand Down

0 comments on commit eac623b

Please sign in to comment.