summaryrefslogtreecommitdiffstats
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2016-08-16 16:48:36 -0700
committerJens Axboe <axboe@fb.com>2016-08-16 19:36:14 -0600
commit1b856086813be9371929b6cc62045f9fd470f5a0 (patch)
tree2ed054abb499ec7f19b63f9f5b24acff932d079f /block/blk-core.c
parent7afafc8a44bf0ab841b17d450b02aedb3a138985 (diff)
downloadop-kernel-dev-1b856086813be9371929b6cc62045f9fd470f5a0.zip
op-kernel-dev-1b856086813be9371929b6cc62045f9fd470f5a0.tar.gz
block: Fix race triggered by blk_set_queue_dying()
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>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 999442e..36c7ac3 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -515,7 +515,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);
OpenPOWER on IntegriCloud