summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2012-09-26 05:19:25 +0200
committerTheodore Ts'o <tytso@mit.edu>2012-09-26 05:19:25 +0200
commit7f1468d1d50d368097ab13596dc08eaba7eace7f (patch)
tree6215860a4aabdec7d725ae901b13bba31514b583
parentext4: check free inode count before allocating an inode (diff)
downloadlinux-7f1468d1d50d368097ab13596dc08eaba7eace7f.tar.xz
linux-7f1468d1d50d368097ab13596dc08eaba7eace7f.zip
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>
-rw-r--r--fs/ext4/resize.c15
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)
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;
}