diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2016-08-16 16:48:36 -0700 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2016-08-31 19:21:09 -0400 |
commit | 26390c7073a70d57c5c0de7c44f909fc91f3c66b (patch) | |
tree | 1b29dec931fdad55366a78954480d3819464dfdb /block | |
parent | 0df5268514aafd144b5b0402d03a21951961fa9f (diff) |
block: Fix race triggered by blk_set_queue_dying()
[ Upstream commit 1b856086813be9371929b6cc62045f9fd470f5a0 ]
blk_set_queue_dying() can be called while another thread is
submitting I/O or changing queue flags, e.g. through dm_stop_queue().
Hence protect the QUEUE_FLAG_DYING flag change with locking.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 7f29dc0237d1..bbbf36e6066b 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -475,7 +475,9 @@ EXPORT_SYMBOL_GPL(blk_queue_bypass_end); void blk_set_queue_dying(struct request_queue *q) { - queue_flag_set_unlocked(QUEUE_FLAG_DYING, q); + spin_lock_irq(q->queue_lock); + queue_flag_set(QUEUE_FLAG_DYING, q); + spin_unlock_irq(q->queue_lock); if (q->mq_ops) blk_mq_wake_waiters(q); |