@@ -142,6 +142,8 @@ int btrfs_insert_dir_item(struct
btrfs_trans_handle *trans, struct btrfs_root
key.offset = btrfs_name_hash(name, name_len);
path = btrfs_alloc_path();
+ if (!path)
+ return -ENOMEM;
path->leave_spinning = 1;
data_size = sizeof(*dir_item) + name_len;
@@ -176,6 +176,10 @@ static struct dentry *btrfs_get_parent(struct
dentry *child)
int ret;
path = btrfs_alloc_path();
+ if (!path) {
+ ret = -ENOMEM;
+ goto fail1;
+ }
if (dir->i_ino == BTRFS_FIRST_FREE_OBJECTID) {
key.objectid = root->root_key.objectid;
@@ -229,6 +233,7 @@ static struct dentry *btrfs_get_parent(struct dentry *child)
return dentry;
fail:
btrfs_free_path(path);
+fail1:
return ERR_PTR(ret);
}
@@ -607,6 +607,8 @@ retry:
GFP_NOFS);
trans = btrfs_join_transaction(root, 1);
+ BUG_ON(!trans);
+
ret = btrfs_reserve_extent(trans, root,
async_extent->compressed_size,
async_extent->compressed_size,
@@ -1680,6 +1682,7 @@ static int btrfs_finish_ordered_io(struct inode
*inode, u64 start, u64 end)
0, &cached_state, GFP_NOFS);
trans = btrfs_join_transaction(root, 1);
+ BUG_ON(!trans);
if (test_bit(BTRFS_ORDERED_COMPRESSED, &ordered_extent->flags))
compressed = 1;
@@ -3955,6 +3958,7 @@ int btrfs_write_inode(struct inode *inode,
struct writeback_control *wbc)
if (wbc->sync_mode == WB_SYNC_ALL) {
trans = btrfs_join_transaction(root, 1);
+ BUG_ON(!trans);
btrfs_set_trans_block_group(trans, inode);
ret = btrfs_commit_transaction(trans, root);
}
@@ -3973,6 +3977,7 @@ void btrfs_dirty_inode(struct inode *inode)
struct btrfs_trans_handle *trans;
trans = btrfs_join_transaction(root, 1);
+ BUG_ON(!trans);
btrfs_set_trans_block_group(trans, inode);
btrfs_update_inode(trans, root, inode);
btrfs_end_transaction(trans, root);
@@ -173,6 +173,8 @@ static struct btrfs_trans_handle
*start_transaction(struct btrfs_root *root,
int ret;
mutex_lock(&root->fs_info->trans_mutex);
+ if (!h)
+ goto out;
if (!root->fs_info->log_root_recovering &&
((type == TRANS_START && !root->fs_info->open_ioctl_trans) ||