diff options
author | Roel Kluin <12o3l@tiscali.nl> | 2008-04-29 22:01:15 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-04-29 22:01:15 -0400 |
commit | f1fa3342e271029f93d323ca664809b94594fe04 (patch) | |
tree | a157efee03b64049dda19f4292961e085949cc81 /fs/ext4 | |
parent | f8a87d89304c1eea8e4a8dc02d134f57590913c6 (diff) |
ext4: fix hot spins in mballoc after err_freebuddy and err_freemeta
In ext4_mb_init_backend() 'i' is of type ext4_group_t. Since unsigned, i
>= 0 is always true, so fix hot spins after err_freebuddy: and -meta:
and prevent decrements when zero.
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/mballoc.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 11e1fd59acbd..fbec2ef93797 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2272,13 +2272,13 @@ static int ext4_mb_init_backend(struct super_block *sb) | |||
2272 | meta_group_info[j] = kzalloc(len, GFP_KERNEL); | 2272 | meta_group_info[j] = kzalloc(len, GFP_KERNEL); |
2273 | if (meta_group_info[j] == NULL) { | 2273 | if (meta_group_info[j] == NULL) { |
2274 | printk(KERN_ERR "EXT4-fs: can't allocate buddy mem\n"); | 2274 | printk(KERN_ERR "EXT4-fs: can't allocate buddy mem\n"); |
2275 | i--; | ||
2276 | goto err_freebuddy; | 2275 | goto err_freebuddy; |
2277 | } | 2276 | } |
2278 | desc = ext4_get_group_desc(sb, i, NULL); | 2277 | desc = ext4_get_group_desc(sb, i, NULL); |
2279 | if (desc == NULL) { | 2278 | if (desc == NULL) { |
2280 | printk(KERN_ERR | 2279 | printk(KERN_ERR |
2281 | "EXT4-fs: can't read descriptor %lu\n", i); | 2280 | "EXT4-fs: can't read descriptor %lu\n", i); |
2281 | i++; | ||
2282 | goto err_freebuddy; | 2282 | goto err_freebuddy; |
2283 | } | 2283 | } |
2284 | memset(meta_group_info[j], 0, len); | 2284 | memset(meta_group_info[j], 0, len); |
@@ -2318,13 +2318,11 @@ static int ext4_mb_init_backend(struct super_block *sb) | |||
2318 | return 0; | 2318 | return 0; |
2319 | 2319 | ||
2320 | err_freebuddy: | 2320 | err_freebuddy: |
2321 | while (i >= 0) { | 2321 | while (i-- > 0) |
2322 | kfree(ext4_get_group_info(sb, i)); | 2322 | kfree(ext4_get_group_info(sb, i)); |
2323 | i--; | ||
2324 | } | ||
2325 | i = num_meta_group_infos; | 2323 | i = num_meta_group_infos; |
2326 | err_freemeta: | 2324 | err_freemeta: |
2327 | while (--i >= 0) | 2325 | while (i-- > 0) |
2328 | kfree(sbi->s_group_info[i]); | 2326 | kfree(sbi->s_group_info[i]); |
2329 | iput(sbi->s_buddy_cache); | 2327 | iput(sbi->s_buddy_cache); |
2330 | err_freesgi: | 2328 | err_freesgi: |