From 128758cedc3947b4a2328141c387ab0933dbbf60 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Sat, 26 Jun 2010 11:26:46 +1000 Subject: [PATCH] Be Careful about cleaning PinPending blocks. PinPending blocks must never be written to the cleaner segment as they might still get dirtied and need to be written in this phase, but the cleaner will have taken their uninc credit. So if we need to clean a PinPending block, just mark it dirty and wait for it to be unpinned or written normally. Signed-off-by: NeilBrown --- clean.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/clean.c b/clean.c index 80d9d3c..4cbc41a 100644 --- a/clean.c +++ b/clean.c @@ -231,6 +231,17 @@ static void cleaner_flush(struct fs *fs) dprintk("cleaning %s\n", strblk(b)); + if (test_bit(B_PinPending, &b->flags)) { + /* Cannot safely clean this now. Just make + * it Dirty (it probably will be soon anyway) + * so it gets written to the new-data segment + * which will effectively clean it. + */ + if (!test_and_set_bit(B_Dirty, &b->flags)) + if (!test_and_clear_bit(B_Realloc, &b->flags)) + if (!test_and_clear_bit(B_Credit, &b->flags)) + LAFS_BUG(1, b); + } if (test_bit(B_Dirty, &b->flags)) { /* Ignore this, checkpoint will take it */ if (test_and_clear_bit(B_Realloc, &b->flags)) -- 2.39.5