Skip to content

Commit

Permalink
ext4: fix double unlock buffer mess during fs-resize
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dmitry Monakhov authored and Theodore Ts'o committed Sep 26, 2012
1 parent f2a09af commit 7f1468d
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions fs/ext4/resize.c
Original file line number Diff line number Diff line change
Expand Up @@ -1181,17 +1181,12 @@ static struct buffer_head *ext4_get_bitmap(struct super_block *sb, __u64 block)
struct buffer_head *bh = sb_getblk(sb, block);
if (!bh)
return NULL;

if (bitmap_uptodate(bh))
return bh;

lock_buffer(bh);
if (bh_submit_read(bh) < 0) {
unlock_buffer(bh);
brelse(bh);
return NULL;
if (!bh_uptodate_or_lock(bh)) {
if (bh_submit_read(bh) < 0) {
brelse(bh);
return NULL;
}
}
unlock_buffer(bh);

return bh;
}
Expand Down

0 comments on commit 7f1468d

Please sign in to comment.