Skip to content

Commit cd84bbb

Browse files
brenns10tytso
authored andcommitted
ext4: use ext4_grp_locked_error in mb_find_extent
Commit 5d1b1b3 ("ext4: fix BUG when calling ext4_error with locked block group") introduces ext4_grp_locked_error to handle unlocking a group in error cases. Otherwise, there is a possibility of a sleep while atomic. However, since 43c7322 ("ext4: replace BUG_ON with WARN_ON in mb_find_extent()"), mb_find_extent() has contained a ext4_error() call while a group spinlock is held. Replace this with ext4_grp_locked_error. Fixes: 43c7322 ("ext4: replace BUG_ON with WARN_ON in mb_find_extent()") Cc: <stable@vger.kernel.org> # 4.14+ Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com> Reviewed-by: Lukas Czerner <lczerner@redhat.com> Reviewed-by: Junxiao Bi <junxiao.bi@oracle.com> Link: https://lore.kernel.org/r/20210623232114.34457-1-stephen.s.brennan@oracle.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent 558d645 commit cd84bbb

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

fs/ext4/mballoc.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,10 +1909,11 @@ static int mb_find_extent(struct ext4_buddy *e4b, int block,
19091909
if (ex->fe_start + ex->fe_len > EXT4_CLUSTERS_PER_GROUP(e4b->bd_sb)) {
19101910
/* Should never happen! (but apparently sometimes does?!?) */
19111911
WARN_ON(1);
1912-
ext4_error(e4b->bd_sb, "corruption or bug in mb_find_extent "
1913-
"block=%d, order=%d needed=%d ex=%u/%d/%d@%u",
1914-
block, order, needed, ex->fe_group, ex->fe_start,
1915-
ex->fe_len, ex->fe_logical);
1912+
ext4_grp_locked_error(e4b->bd_sb, e4b->bd_group, 0, 0,
1913+
"corruption or bug in mb_find_extent "
1914+
"block=%d, order=%d needed=%d ex=%u/%d/%d@%u",
1915+
block, order, needed, ex->fe_group, ex->fe_start,
1916+
ex->fe_len, ex->fe_logical);
19161917
ex->fe_len = 0;
19171918
ex->fe_start = 0;
19181919
ex->fe_group = 0;

0 commit comments

Comments
 (0)