Skip to content

Commit 7f1468d

Browse files
Dmitry Monakhovtytso
authored andcommitted
ext4: fix double unlock buffer mess during fs-resize
bh_submit_read() is responsible for unlock bh on endio. In addition, we need to use bh_uptodate_or_lock() to avoid races. Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1 parent f2a09af commit 7f1468d

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

‎fs/ext4/resize.c‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,17 +1181,12 @@ static struct buffer_head *ext4_get_bitmap(struct super_block *sb, __u64 block)
11811181
struct buffer_head *bh = sb_getblk(sb, block);
11821182
if (!bh)
11831183
return NULL;
1184-
1185-
if (bitmap_uptodate(bh))
1186-
return bh;
1187-
1188-
lock_buffer(bh);
1189-
if (bh_submit_read(bh) < 0) {
1190-
unlock_buffer(bh);
1191-
brelse(bh);
1192-
return NULL;
1184+
if (!bh_uptodate_or_lock(bh)) {
1185+
if (bh_submit_read(bh) < 0) {
1186+
brelse(bh);
1187+
return NULL;
1188+
}
11931189
}
1194-
unlock_buffer(bh);
11951190

11961191
return bh;
11971192
}

0 commit comments

Comments
 (0)