loop: defer the queue limits clear to a workqueue - #151
loop: defer the queue limits clear to a workqueue#151blktests-ci-block-trial[bot] wants to merge 1 commit into
Conversation
|
Upstream branch: 1b78070 |
9776a98 to
a309a67
Compare
|
Upstream branch: c20313e |
c15516a to
6adab56
Compare
a309a67 to
b3c6f4f
Compare
|
Upstream branch: 548e7bc |
6adab56 to
c623ce4
Compare
b3c6f4f to
a88aa4a
Compare
|
Upstream branch: cf72cbb |
c623ce4 to
0a3dcf0
Compare
a88aa4a to
fa3448f
Compare
|
Upstream branch: cf72cbb |
0a3dcf0 to
b4baa10
Compare
fa3448f to
b86a2fe
Compare
|
Upstream branch: cf72cbb |
b4baa10 to
4a5b5a5
Compare
b86a2fe to
5728fd2
Compare
|
Upstream branch: 08dbfad |
4a5b5a5 to
4ab9307
Compare
5728fd2 to
b15a0cf
Compare
|
Upstream branch: a23cbb0 |
4ab9307 to
2026154
Compare
b15a0cf to
d4af556
Compare
|
Upstream branch: 78bb208 |
2026154 to
b65c7b8
Compare
d4af556 to
45a2312
Compare
258e7d0 to
76db21d
Compare
|
Upstream branch: 786262b |
cb1b848 to
f24df99
Compare
|
Upstream branch: 786262b |
f24df99 to
5e56993
Compare
76db21d to
e8377ca
Compare
|
Upstream branch: 89a3129 |
5e56993 to
59991d8
Compare
|
Upstream branch: 89a3129 |
59991d8 to
6289bbe
Compare
e8377ca to
1fff761
Compare
|
Upstream branch: 940de59 |
6289bbe to
040cd9e
Compare
|
Upstream branch: 940de59 |
040cd9e to
5b3adef
Compare
1fff761 to
3595ceb
Compare
|
Upstream branch: 841e384 |
5b3adef to
9e35cc9
Compare
3595ceb to
4061e04
Compare
loop_clear_limits() calls queue_limits_commit_update() directly from the loop workqueue that processes the request. That does a non-atomic struct assignment to q->limits without freezing the queue, which races with lockless readers of q->limits on other CPUs - bio splitting reads max_hw_sectors, the discard path reads max_hw_discard_sectors - and can let them observe torn values. The trigger is a discard or write-zeroes request on a loop device whose backing file does not support the corresponding fallocate operation. The code already has an XXX comment saying this should move to a workqueue. Do that: schedule a work item on the system workqueue, where it is safe to freeze the queue around the limits update. Accumulate pending modes in lo->clear_limits_mode so that failures between scheduling and execution of the work item are not lost. A rebinding of the device drops the accumulated modes and invalidates an already scheduled work item, so a stale clear cannot hit the new backing file. The work item is cancelled before the device is freed. Signed-off-by: Tao Cui <cuitao@kylinos.cn>
|
Upstream branch: a500db7 |
9e35cc9 to
34a6695
Compare
Pull request for series with
subject: loop: defer the queue limits clear to a workqueue
version: 1
url: http://redsun45:8000/project/linux-block/list/?series=737