diff options
author | Jan Kara <jack@suse.com> | 2015-10-17 22:35:09 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2015-10-17 22:35:09 -0400 |
commit | 33d14975e5ac469963d5d63856b61698ad0bff07 (patch) | |
tree | faa2e7fab1cc1284ab2bc8537464707d5a61c4c1 /fs/jbd2/checkpoint.c | |
parent | 9c02ac97989d544c89f049e8add7149aaea01671 (diff) |
jbd2: fix checkpoint list cleanup
Unlike comments and expectation of callers journal_clean_one_cp_list()
returned 1 not only if it freed the transaction but also if it freed
some buffers in the transaction. That could make
__jbd2_journal_clean_checkpoint_list() skip processing
t_checkpoint_io_list and continue with processing the next transaction.
This is mostly a cosmetic issue since the only result is we can
sometimes free less memory than we could. But it's still worth fixing.
Fix journal_clean_one_cp_list() to return 1 only if the transaction was
really freed.
Fixes: 50849db32a9f529235a84bcc84a6b8e631b1d0ec
Signed-off-by: Jan Kara <jack@suse.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
Diffstat (limited to 'fs/jbd2/checkpoint.c')
-rw-r--r-- | fs/jbd2/checkpoint.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c index 8c44654ce274..684996c8a3a4 100644 --- a/fs/jbd2/checkpoint.c +++ b/fs/jbd2/checkpoint.c | |||
@@ -427,7 +427,6 @@ static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy) | |||
427 | struct journal_head *last_jh; | 427 | struct journal_head *last_jh; |
428 | struct journal_head *next_jh = jh; | 428 | struct journal_head *next_jh = jh; |
429 | int ret; | 429 | int ret; |
430 | int freed = 0; | ||
431 | 430 | ||
432 | if (!jh) | 431 | if (!jh) |
433 | return 0; | 432 | return 0; |
@@ -441,10 +440,9 @@ static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy) | |||
441 | else | 440 | else |
442 | ret = __jbd2_journal_remove_checkpoint(jh) + 1; | 441 | ret = __jbd2_journal_remove_checkpoint(jh) + 1; |
443 | if (!ret) | 442 | if (!ret) |
444 | return freed; | 443 | return 0; |
445 | if (ret == 2) | 444 | if (ret == 2) |
446 | return 1; | 445 | return 1; |
447 | freed = 1; | ||
448 | /* | 446 | /* |
449 | * This function only frees up some memory | 447 | * This function only frees up some memory |
450 | * if possible so we dont have an obligation | 448 | * if possible so we dont have an obligation |
@@ -452,10 +450,10 @@ static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy) | |||
452 | * requested: | 450 | * requested: |
453 | */ | 451 | */ |
454 | if (need_resched()) | 452 | if (need_resched()) |
455 | return freed; | 453 | return 0; |
456 | } while (jh != last_jh); | 454 | } while (jh != last_jh); |
457 | 455 | ||
458 | return freed; | 456 | return 0; |
459 | } | 457 | } |
460 | 458 | ||
461 | /* | 459 | /* |