Skip to content

Commit

Permalink
Btrfs: check the return value of io_ctl_init()
Browse files Browse the repository at this point in the history
It can return -ENOMEM.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
  • Loading branch information
Li Zefan committed Jan 11, 2012
1 parent a1ee5a4 commit 706efc6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fs/btrfs/free-space-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,10 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
if (!num_entries)
return 0;

io_ctl_init(&io_ctl, inode, root);
ret = io_ctl_init(&io_ctl, inode, root);
if (ret)
return ret;

ret = readahead_cache(inode);
if (ret)
goto out;
Expand Down Expand Up @@ -851,7 +854,9 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
if (!i_size_read(inode))
return -1;

io_ctl_init(&io_ctl, inode, root);
ret = io_ctl_init(&io_ctl, inode, root);
if (ret)
return -1;

/* Get the cluster for this block_group if it exists */
if (block_group && !list_empty(&block_group->cluster_list))
Expand Down

0 comments on commit 706efc6

Please sign in to comment.