]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.31.8/0022-ext4-Use-bforget-in-no-journal-mode-for-ext4_journal.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.31.8 / 0022-ext4-Use-bforget-in-no-journal-mode-for-ext4_journal.patch
1 From 8263746e63ecdc586b2d0c969d905dd78645fa6f Mon Sep 17 00:00:00 2001
2 From: Theodore Ts'o <tytso@mit.edu>
3 Date: Wed, 9 Sep 2009 21:32:41 -0400
4 Subject: [PATCH 22/85] ext4: Use bforget() in no journal mode for ext4_journal_{forget,revoke}()
5
6 (cherry picked from commit c7acb4c16646943180bd221c167a077e0a084f9c)
7
8 When ext4 is using a journal, a metadata block which is deallocated
9 must be passed into the journal layer so it can be dropped from the
10 current transaction and/or revoked. This is done by calling the
11 functions ext4_journal_forget() and ext4_journal_revoke(), which call
12 jbd2_journal_forget(), and jbd2_journal_revoke(), respectively.
13
14 Since the jbd2_journal_forget() and jbd2_journal_revoke() call
15 bforget(), if ext4 is not using a journal, ext4_journal_forget() and
16 ext4_journal_revoke() must call bforget() to avoid a dirty metadata
17 block overwriting a block after it has been reallocated and reused for
18 another inode's data block.
19
20 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
22 ---
23 fs/ext4/ext4_jbd2.c | 4 ++--
24 1 file changed, 2 insertions(+), 2 deletions(-)
25
26 --- a/fs/ext4/ext4_jbd2.c
27 +++ b/fs/ext4/ext4_jbd2.c
28 @@ -44,7 +44,7 @@ int __ext4_journal_forget(const char *wh
29 handle, err);
30 }
31 else
32 - brelse(bh);
33 + bforget(bh);
34 return err;
35 }
36
37 @@ -60,7 +60,7 @@ int __ext4_journal_revoke(const char *wh
38 handle, err);
39 }
40 else
41 - brelse(bh);
42 + bforget(bh);
43 return err;
44 }
45