diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2008-11-23 23:51:53 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-11-23 23:51:53 -0500 |
commit | b7be019e80da4db96d283734d55366014509911c (patch) | |
tree | 86304f0c872dad5200e6015b7e7b56e53ad61ba8 /fs/ext4 | |
parent | 7a2fcbf7f85737735fd44eb34b62315bccf6d6e4 (diff) |
ext4: Fix lockdep recursive locking warning
In ext4_mb_init_group(), if the filesystem block size is less than
PAGE_SIZE/2, the code tries to grab alloc_sem for multiple block
groups in a loop. We need to allow for this by using
down_write_nested() and passing in the loop index as a lock subclass
number. This works because no other code path needs to take multiple
alloc_sem's. Note that lockdep will fail for filesystem blocksize
smaller than to PAGE_SIZE/16k. (e.g., a 1k filesystem blocksize with
a 32k page size, or a 2k filesystem blocksize with a 64k blocksize,
etc.)
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/mballoc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 860766421fe8..0bf4c4c06b19 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -1780,7 +1780,7 @@ int ext4_mb_get_buddy_cache_lock(struct super_block *sb, ext4_group_t group) | |||
1780 | * no block allocation going on in any | 1780 | * no block allocation going on in any |
1781 | * of that groups | 1781 | * of that groups |
1782 | */ | 1782 | */ |
1783 | down_write(&grp->alloc_sem); | 1783 | down_write_nested(&grp->alloc_sem, i); |
1784 | } | 1784 | } |
1785 | return i; | 1785 | return i; |
1786 | } | 1786 | } |