aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3601f0aebdd..8be7d7a759c 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1070,7 +1070,8 @@ static noinline int run_delalloc_nocow(struct inode *inode,
1070 u64 ino = btrfs_ino(inode); 1070 u64 ino = btrfs_ino(inode);
1071 1071
1072 path = btrfs_alloc_path(); 1072 path = btrfs_alloc_path();
1073 BUG_ON(!path); 1073 if (!path)
1074 return -ENOMEM;
1074 1075
1075 nolock = is_free_space_inode(root, inode); 1076 nolock = is_free_space_inode(root, inode);
1076 1077
@@ -1644,7 +1645,8 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
1644 int ret; 1645 int ret;
1645 1646
1646 path = btrfs_alloc_path(); 1647 path = btrfs_alloc_path();
1647 BUG_ON(!path); 1648 if (!path)
1649 return -ENOMEM;
1648 1650
1649 path->leave_spinning = 1; 1651 path->leave_spinning = 1;
1650 1652
@@ -3713,7 +3715,8 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
3713 int ret = 0; 3715 int ret = 0;
3714 3716
3715 path = btrfs_alloc_path(); 3717 path = btrfs_alloc_path();
3716 BUG_ON(!path); 3718 if (!path)
3719 return -ENOMEM;
3717 3720
3718 di = btrfs_lookup_dir_item(NULL, root, path, btrfs_ino(dir), name, 3721 di = btrfs_lookup_dir_item(NULL, root, path, btrfs_ino(dir), name,
3719 namelen, 0); 3722 namelen, 0);
@@ -4438,7 +4441,8 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
4438 int owner; 4441 int owner;
4439 4442
4440 path = btrfs_alloc_path(); 4443 path = btrfs_alloc_path();
4441 BUG_ON(!path); 4444 if (!path)
4445 return ERR_PTR(-ENOMEM);
4442 4446
4443 inode = new_inode(root->fs_info->sb); 4447 inode = new_inode(root->fs_info->sb);
4444 if (!inode) { 4448 if (!inode) {
@@ -7194,7 +7198,11 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
7194 goto out_unlock; 7198 goto out_unlock;
7195 7199
7196 path = btrfs_alloc_path(); 7200 path = btrfs_alloc_path();
7197 BUG_ON(!path); 7201 if (!path) {
7202 err = -ENOMEM;
7203 drop_inode = 1;
7204 goto out_unlock;
7205 }
7198 key.objectid = btrfs_ino(inode); 7206 key.objectid = btrfs_ino(inode);
7199 key.offset = 0; 7207 key.offset = 0;
7200 btrfs_set_key_type(&key, BTRFS_EXTENT_DATA_KEY); 7208 btrfs_set_key_type(&key, BTRFS_EXTENT_DATA_KEY);