From c05d7ab9f15a0c6707e39a341f08558830708697 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Thu, 11 Mar 2004 16:22:27 -0800 Subject: [PATCH] [PATCH] Narrow blk_congestion_wait races From: Nick Piggin 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. --- drivers/block/ll_rw_blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 5371a98fe6ba9..e86d06e47d533 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -109,6 +109,7 @@ static void clear_queue_congested(request_queue_t *q, int rw) bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested; clear_bit(bit, &q->backing_dev_info.state); + smp_mb__after_clear_bit(); if (waitqueue_active(wqh)) wake_up(wqh); } @@ -1546,7 +1547,6 @@ static void freed_request(request_queue_t *q, int rw) if (rl->count[rw] < queue_congestion_off_threshold(q)) clear_queue_congested(q, rw); if (rl->count[rw]+1 <= q->nr_requests) { - smp_mb(); if (waitqueue_active(&rl->wait[rw])) wake_up(&rl->wait[rw]); if (!waitqueue_active(&rl->wait[rw])) -- 2.53.0