diff options
| author | Bart Van Assche <[email protected]> | 2018-02-28 10:15:33 -0800 |
|---|---|---|
| committer | Jens Axboe <[email protected]> | 2018-02-28 12:23:35 -0700 |
| commit | a063057d7c731cffa7d10740e8ebc2970df8dbb3 (patch) | |
| tree | 40895bc044e82ff993d698128c5b24f6d0c82c0a /tools/perf/scripts/python/call-graph-from-sql.py | |
| parent | 498f6650aec864e331cae7575fec5f07781d0bf3 (diff) | |
block: Fix a race between request queue removal and the block cgroup controller
Avoid that the following race can occur:
blk_cleanup_queue() blkcg_print_blkgs()
spin_lock_irq(lock) (1) spin_lock_irq(blkg->q->queue_lock) (2,5)
q->queue_lock = &q->__queue_lock (3)
spin_unlock_irq(lock) (4)
spin_unlock_irq(blkg->q->queue_lock) (6)
(1) take driver lock;
(2) busy loop for driver lock;
(3) override driver lock with internal lock;
(4) unlock driver lock;
(5) can take driver lock now;
(6) but unlock internal lock.
This change is safe because only the SCSI core and the NVME core keep
a reference on a request queue after having called blk_cleanup_queue().
Neither driver accesses any of the removed data structures between its
blk_cleanup_queue() and blk_put_queue() calls.
Reported-by: Joseph Qi <[email protected]>
Signed-off-by: Bart Van Assche <[email protected]>
Reviewed-by: Joseph Qi <[email protected]>
Cc: Jan Kara <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/call-graph-from-sql.py')
0 files changed, 0 insertions, 0 deletions