]> git.neil.brown.name Git - LaFS.git/commitdiff
Don't remove a block from cleaning list until B_Realloc is set.
authorNeilBrown <neilb@suse.de>
Fri, 2 Jul 2010 23:21:21 +0000 (09:21 +1000)
committerNeilBrown <neilb@suse.de>
Sat, 3 Jul 2010 00:00:07 +0000 (10:00 +1000)
This ensures that a race with erase_dblock will either run
into the mutex, or be able to clear Realloc immediately.

Signed-off-by: NeilBrown <neilb@suse.de>
clean.c

diff --git a/clean.c b/clean.c
index 17812c7c39eefc8b2ead7365c063611d1a9ca73c..3744ec304c9cb99f71405c3cad507461847ca73b 100644 (file)
--- a/clean.c
+++ b/clean.c
@@ -487,9 +487,9 @@ static int try_clean(struct fs *fs, struct toclean *tc)
                        putref(cb, MKREF(clean2));
                        continue;
                }
-               list_del_init(&b->cleaning);
 
                if (err) {
+                       list_del_init(&b->cleaning);
                        iput(b->b.inode);
                        putref(cb, MKREF(clean2));
                        putdref(b, MKREF(cleaning));
@@ -504,6 +504,7 @@ static int try_clean(struct fs *fs, struct toclean *tc)
                 * ref on the inode, so it is safe to drop our
                 * ref now
                 */
+               list_del_init(&b->cleaning);
                iput(b->b.inode);
                putdref(b, MKREF(cleaning));
                putref(cb, MKREF(clean2));