diff options
author | dingdinghua <dingdinghua@nrchpc.ac.cn> | 2010-02-15 16:35:42 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-02-15 16:35:42 -0500 |
commit | ba869023eac8354b17acdcff82b851ea8e7b1809 (patch) | |
tree | c461ae44ed5f9fc45573c14c74548f3f50109547 /fs/jbd2/commit.c | |
parent | aca92ff6f57c000d1b4523e383c8bd6b8269b8b1 (diff) |
jbd2: delay discarding buffers in journal_unmap_buffer
Delay discarding buffers in journal_unmap_buffer until
we know that "add to orphan" operation has definitely been
committed, otherwise the log space of committing transation
may be freed and reused before truncate get committed, updates
may get lost if crash happens.
Signed-off-by: dingdinghua <dingdinghua@nrchpc.ac.cn>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/jbd2/commit.c')
-rw-r--r-- | fs/jbd2/commit.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 1bc74b6f26d2..3ee211ed58f1 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -930,12 +930,12 @@ restart_loop: | |||
930 | /* A buffer which has been freed while still being | 930 | /* A buffer which has been freed while still being |
931 | * journaled by a previous transaction may end up still | 931 | * journaled by a previous transaction may end up still |
932 | * being dirty here, but we want to avoid writing back | 932 | * being dirty here, but we want to avoid writing back |
933 | * that buffer in the future now that the last use has | 933 | * that buffer in the future after the "add to orphan" |
934 | * been committed. That's not only a performance gain, | 934 | * operation been committed, That's not only a performance |
935 | * it also stops aliasing problems if the buffer is left | 935 | * gain, it also stops aliasing problems if the buffer is |
936 | * behind for writeback and gets reallocated for another | 936 | * left behind for writeback and gets reallocated for another |
937 | * use in a different page. */ | 937 | * use in a different page. */ |
938 | if (buffer_freed(bh)) { | 938 | if (buffer_freed(bh) && !jh->b_next_transaction) { |
939 | clear_buffer_freed(bh); | 939 | clear_buffer_freed(bh); |
940 | clear_buffer_jbddirty(bh); | 940 | clear_buffer_jbddirty(bh); |
941 | } | 941 | } |