Commit c05d7ab9 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Narrow blk_congestion_wait races

From: Nick Piggin <piggin@cyberone.com.au>

The addition of the smp_mb and the other change is to try to close the
window for races a bit.  Obviously they can still happen, it's a racy
interface and it doesn't matter much.
parent f3179458
...@@ -109,6 +109,7 @@ static void clear_queue_congested(request_queue_t *q, int rw) ...@@ -109,6 +109,7 @@ static void clear_queue_congested(request_queue_t *q, int rw)
bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested; bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested;
clear_bit(bit, &q->backing_dev_info.state); clear_bit(bit, &q->backing_dev_info.state);
smp_mb__after_clear_bit();
if (waitqueue_active(wqh)) if (waitqueue_active(wqh))
wake_up(wqh); wake_up(wqh);
} }
...@@ -1546,7 +1547,6 @@ static void freed_request(request_queue_t *q, int rw) ...@@ -1546,7 +1547,6 @@ static void freed_request(request_queue_t *q, int rw)
if (rl->count[rw] < queue_congestion_off_threshold(q)) if (rl->count[rw] < queue_congestion_off_threshold(q))
clear_queue_congested(q, rw); clear_queue_congested(q, rw);
if (rl->count[rw]+1 <= q->nr_requests) { if (rl->count[rw]+1 <= q->nr_requests) {
smp_mb();
if (waitqueue_active(&rl->wait[rw])) if (waitqueue_active(&rl->wait[rw]))
wake_up(&rl->wait[rw]); wake_up(&rl->wait[rw]);
if (!waitqueue_active(&rl->wait[rw])) if (!waitqueue_active(&rl->wait[rw]))
......
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