diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-04-22 21:00:36 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-04-22 21:00:36 -0400 |
commit | b5451f7b2694b04d9f912f6cf09db1729f291996 (patch) | |
tree | a1221f12730bc54357fc7600de2b5fbcce97cac3 /fs/ext4/ialloc.c | |
parent | e84a26ce178345498a7eca0590852bcc36f1092f (diff) |
ext4: Fix potential inode allocation soft lockup in Orlov allocator
If the Orlov allocator is having trouble finding an appropriate block
group, the fallback code could loop forever, causing a soft lockup
warning in find_group_orlov():
BUG: soft lockup - CPU#0 stuck for 61s! [cp:11728]
...
Pid: 11728, comm: cp Not tainted (2.6.30-rc1-dirty #77) Lenovo
EIP: 0060:[<c021650e>] EFLAGS: 00000246 CPU: 0
EIP is at ext4_get_group_desc+0x54/0x9d
...
Call Trace:
[<c0218021>] find_group_orlov+0x2ee/0x334
[<c0120a5f>] ? sched_clock+0x8/0xb
[<c02188e3>] ext4_new_inode+0x2cf/0xb1a
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ialloc.c')
-rw-r--r-- | fs/ext4/ialloc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index cbce5aa6b927..f18e0a08a6b5 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -585,6 +585,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent, | |||
585 | fallback: | 585 | fallback: |
586 | ngroups = sbi->s_groups_count; | 586 | ngroups = sbi->s_groups_count; |
587 | avefreei = freei / ngroups; | 587 | avefreei = freei / ngroups; |
588 | fallback_retry: | ||
588 | parent_group = EXT4_I(parent)->i_block_group; | 589 | parent_group = EXT4_I(parent)->i_block_group; |
589 | for (i = 0; i < ngroups; i++) { | 590 | for (i = 0; i < ngroups; i++) { |
590 | grp = (parent_group + i) % ngroups; | 591 | grp = (parent_group + i) % ngroups; |
@@ -602,7 +603,7 @@ fallback: | |||
602 | * filesystems the above test can fail to find any blockgroups | 603 | * filesystems the above test can fail to find any blockgroups |
603 | */ | 604 | */ |
604 | avefreei = 0; | 605 | avefreei = 0; |
605 | goto fallback; | 606 | goto fallback_retry; |
606 | } | 607 | } |
607 | 608 | ||
608 | return -1; | 609 | return -1; |