Add ext4-printk-throttling patch
[ext4-patch-queue.git] / add-missing-unlock-to-ext4-check-descriptors
bloba6e9dd8863f68a05ebadb7db06bee93710f26988
1 ext4: add missing unlock in ext4_check_descriptors() on error path
3 From: Li Zefan <lizf@cn.fujitsu.com>
5 If there group descriptors are corrupted we need unlock the block
6 group lock before returning from the function; else we will oops when
7 freeing a spinlock which is still being held.
9 Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
10 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 ---
12  fs/ext4/super.c |    4 +++-
13  1 files changed, 3 insertions(+), 1 deletions(-)
15 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
16 index 566344b..24e7df6 100644
17 --- a/fs/ext4/super.c
18 +++ b/fs/ext4/super.c
19 @@ -1623,8 +1623,10 @@ static int ext4_check_descriptors(struct super_block *sb)
20                                "Checksum for group %lu failed (%u!=%u)\n",
21                                i, le16_to_cpu(ext4_group_desc_csum(sbi, i,
22                                gdp)), le16_to_cpu(gdp->bg_checksum));
23 -                       if (!(sb->s_flags & MS_RDONLY))
24 +                       if (!(sb->s_flags & MS_RDONLY)) {
25 +                               spin_unlock(sb_bgl_lock(sbi, i));
26                                 return 0;
27 +                       }
28                 }
29                 spin_unlock(sb_bgl_lock(sbi, i));
30                 if (!flexbg_flag)