[PATCH 1/3] writeback: add memory barrier before wake_up_bit() in bdi_work_free()

From: Jens Axboe
Date: Tue May 19 2009 - 03:47:02 EST


As per wake_up_bit() documentation, was also triggered in the wild.
Process got stuck forever waiting for a bit clear that had happened.

Signed-off-by: Jens Axboe <jens.axboe@xxxxxxxxxx>
---
fs/fs-writeback.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index a287c09..6052701 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -102,6 +102,7 @@ static void bdi_work_free(struct rcu_head *head)
kfree(work);
else {
clear_bit(0, &work->state);
+ smp_mb__after_clear_bit();
wake_up_bit(&work->state, 0);
}
}
--
1.6.3.9.g6345


--cWoXeonUoKmBZSoM
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0002-writeback-attempt-to-allocate-work-struct-in-bdi_sta.patch"