提交 018642a1 编写于 作者: T Tsutomu Itoh 提交者: Josef Bacik

Btrfs: return value of btrfs_read_buffer is checked correctly

btrfs_read_buffer() has the possibility of returning the error.
Therefore, I add the code in which the return value of btrfs_read_buffer()
is checked.
Signed-off-by: NTsutomu Itoh <t-itoh@jp.fujitsu.com>
上级 733f4fbb
...@@ -739,7 +739,11 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, ...@@ -739,7 +739,11 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
if (!cur) if (!cur)
return -EIO; return -EIO;
} else if (!uptodate) { } else if (!uptodate) {
btrfs_read_buffer(cur, gen); err = btrfs_read_buffer(cur, gen);
if (err) {
free_extent_buffer(cur);
return err;
}
} }
} }
if (search_start == 0) if (search_start == 0)
......
...@@ -1628,7 +1628,9 @@ static int replay_one_buffer(struct btrfs_root *log, struct extent_buffer *eb, ...@@ -1628,7 +1628,9 @@ static int replay_one_buffer(struct btrfs_root *log, struct extent_buffer *eb,
int i; int i;
int ret; int ret;
btrfs_read_buffer(eb, gen); ret = btrfs_read_buffer(eb, gen);
if (ret)
return ret;
level = btrfs_header_level(eb); level = btrfs_header_level(eb);
...@@ -1749,7 +1751,11 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans, ...@@ -1749,7 +1751,11 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
path->slots[*level]++; path->slots[*level]++;
if (wc->free) { if (wc->free) {
btrfs_read_buffer(next, ptr_gen); ret = btrfs_read_buffer(next, ptr_gen);
if (ret) {
free_extent_buffer(next);
return ret;
}
btrfs_tree_lock(next); btrfs_tree_lock(next);
btrfs_set_lock_blocking(next); btrfs_set_lock_blocking(next);
...@@ -1766,7 +1772,11 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans, ...@@ -1766,7 +1772,11 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
free_extent_buffer(next); free_extent_buffer(next);
continue; continue;
} }
btrfs_read_buffer(next, ptr_gen); ret = btrfs_read_buffer(next, ptr_gen);
if (ret) {
free_extent_buffer(next);
return ret;
}
WARN_ON(*level <= 0); WARN_ON(*level <= 0);
if (path->nodes[*level-1]) if (path->nodes[*level-1])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册