diff options
author | Dmitry Monakhov <dmonakhov@openvz.org> | 2012-09-25 23:19:25 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-09-25 23:19:25 -0400 |
commit | 7f1468d1d50d368097ab13596dc08eaba7eace7f (patch) | |
tree | 6215860a4aabdec7d725ae901b13bba31514b583 /fs/ext4 | |
parent | f2a09af645b762f8230e7eba7fee3b6f7e6e96e7 (diff) |
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>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/resize.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 9f821ce39800..f21fdbf5c75d 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -1181,17 +1181,12 @@ static struct buffer_head *ext4_get_bitmap(struct super_block *sb, __u64 block) | |||
1181 | struct buffer_head *bh = sb_getblk(sb, block); | 1181 | struct buffer_head *bh = sb_getblk(sb, block); |
1182 | if (!bh) | 1182 | if (!bh) |
1183 | return NULL; | 1183 | return NULL; |
1184 | 1184 | if (!bh_uptodate_or_lock(bh)) { | |
1185 | if (bitmap_uptodate(bh)) | 1185 | if (bh_submit_read(bh) < 0) { |
1186 | return bh; | 1186 | brelse(bh); |
1187 | 1187 | return NULL; | |
1188 | lock_buffer(bh); | 1188 | } |
1189 | if (bh_submit_read(bh) < 0) { | ||
1190 | unlock_buffer(bh); | ||
1191 | brelse(bh); | ||
1192 | return NULL; | ||
1193 | } | 1189 | } |
1194 | unlock_buffer(bh); | ||
1195 | 1190 | ||
1196 | return bh; | 1191 | return bh; |
1197 | } | 1192 | } |