Skip to content

Commit

Permalink
ext4: Fix lockdep recursive locking warning
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: "Theodore Ts'o" <[email protected]>
  • Loading branch information
kvaneesh authored and tytso committed Nov 24, 2008
1 parent 7a2fcbf commit b7be019
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1780,7 +1780,7 @@ int ext4_mb_get_buddy_cache_lock(struct super_block *sb, ext4_group_t group)
* no block allocation going on in any
* of that groups
*/
down_write(&grp->alloc_sem);
down_write_nested(&grp->alloc_sem, i);
}
return i;
}
Expand Down

0 comments on commit b7be019

Please sign in to comment.