]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.31.8/0079-ext4-wait-for-log-to-commit-when-umounting.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.31.8 / 0079-ext4-wait-for-log-to-commit-when-umounting.patch
1 From c086b107c572cba6d3600ae292a1e23627756fb0 Mon Sep 17 00:00:00 2001
2 From: Josef Bacik <josef@redhat.com>
3 Date: Tue, 8 Dec 2009 21:48:58 -0500
4 Subject: [PATCH 79/85] ext4: wait for log to commit when umounting
5
6 (cherry picked from commit d4edac314e9ad0b21ba20ba8bc61b61f186f79e1)
7
8 There is a potential race when a transaction is committing right when
9 the file system is being umounting. This could reduce in a race
10 because EXT4_SB(sb)->s_group_info could be freed in ext4_put_super
11 before the commit code calls a callback so the mballoc code can
12 release freed blocks in the transaction, resulting in a panic trying
13 to access the freed s_group_info.
14
15 The fix is to wait for the transaction to finish committing before we
16 shutdown the multiblock allocator.
17
18 Signed-off-by: Josef Bacik <josef@redhat.com>
19 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
21 ---
22 fs/ext4/super.c | 10 ++++++----
23 1 file changed, 6 insertions(+), 4 deletions(-)
24
25 --- a/fs/ext4/super.c
26 +++ b/fs/ext4/super.c
27 @@ -610,10 +610,6 @@ static void ext4_put_super(struct super_
28 if (sb->s_dirt)
29 ext4_commit_super(sb, 1);
30
31 - ext4_release_system_zone(sb);
32 - ext4_mb_release(sb);
33 - ext4_ext_release(sb);
34 - ext4_xattr_put_super(sb);
35 if (sbi->s_journal) {
36 err = jbd2_journal_destroy(sbi->s_journal);
37 sbi->s_journal = NULL;
38 @@ -621,6 +617,12 @@ static void ext4_put_super(struct super_
39 ext4_abort(sb, __func__,
40 "Couldn't clean up the journal");
41 }
42 +
43 + ext4_release_system_zone(sb);
44 + ext4_mb_release(sb);
45 + ext4_ext_release(sb);
46 + ext4_xattr_put_super(sb);
47 +
48 if (!(sb->s_flags & MS_RDONLY)) {
49 EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
50 es->s_state = cpu_to_le16(sbi->s_mount_state);