Commit 26390c70 authored by Bart Van Assche's avatar Bart Van Assche Committed by Sasha Levin

block: Fix race triggered by blk_set_queue_dying()

[ Upstream commit 1b856086 ]

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: default avatarBart 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: default avatarJens Axboe <axboe@fb.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 0df52685
...@@ -475,7 +475,9 @@ EXPORT_SYMBOL_GPL(blk_queue_bypass_end); ...@@ -475,7 +475,9 @@ EXPORT_SYMBOL_GPL(blk_queue_bypass_end);
void blk_set_queue_dying(struct request_queue *q) 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) if (q->mq_ops)
blk_mq_wake_waiters(q); blk_mq_wake_waiters(q);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment