From: NeilBrown Date: Sat, 26 Jun 2010 01:26:46 +0000 (+1000) Subject: Be Careful about cleaning PinPending blocks. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=128758cedc3947b4a2328141c387ab0933dbbf60;p=LaFS.git 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 --- 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))