Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98d5dc13 authored by Tsutomu Itoh's avatar Tsutomu Itoh Committed by Chris Mason
Browse files

btrfs: fix return value check of btrfs_start_transaction()



The error check of btrfs_start_transaction() is added, and the mistake
of the error check on several places is corrected.

Signed-off-by: default avatarTsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 5df67083
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -6271,6 +6271,8 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
	BUG_ON(!wc);

	trans = btrfs_start_transaction(tree_root, 0);
	BUG_ON(IS_ERR(trans));

	if (block_rsv)
		trans->block_rsv = block_rsv;

@@ -6368,6 +6370,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,

			btrfs_end_transaction_throttle(trans, tree_root);
			trans = btrfs_start_transaction(tree_root, 0);
			BUG_ON(IS_ERR(trans));
			if (block_rsv)
				trans->block_rsv = block_rsv;
		}
@@ -7587,7 +7590,7 @@ int btrfs_cleanup_reloc_trees(struct btrfs_root *root)

	if (found) {
		trans = btrfs_start_transaction(root, 1);
		BUG_ON(!trans);
		BUG_ON(IS_ERR(trans));
		ret = btrfs_commit_transaction(trans, root);
		BUG_ON(ret);
	}
@@ -7831,7 +7834,7 @@ static noinline int relocate_one_extent(struct btrfs_root *extent_root,


	trans = btrfs_start_transaction(extent_root, 1);
	BUG_ON(!trans);
	BUG_ON(IS_ERR(trans));

	if (extent_key->objectid == 0) {
		ret = del_extent_zero(trans, extent_root, path, extent_key);
+1 −0
Original line number Diff line number Diff line
@@ -2357,6 +2357,7 @@ void btrfs_orphan_cleanup(struct btrfs_root *root)
		 */
		if (is_bad_inode(inode)) {
			trans = btrfs_start_transaction(root, 0);
			BUG_ON(IS_ERR(trans));
			btrfs_orphan_del(trans, inode);
			btrfs_end_transaction(trans, root);
			iput(inode);
+8 −2
Original line number Diff line number Diff line
@@ -907,6 +907,10 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root,

	if (new_size > old_size) {
		trans = btrfs_start_transaction(root, 0);
		if (IS_ERR(trans)) {
			ret = PTR_ERR(trans);
			goto out_unlock;
		}
		ret = btrfs_grow_device(trans, device, new_size);
		btrfs_commit_transaction(trans, root);
	} else {
@@ -2141,9 +2145,9 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
	path->leave_spinning = 1;

	trans = btrfs_start_transaction(root, 1);
	if (!trans) {
	if (IS_ERR(trans)) {
		btrfs_free_path(path);
		return -ENOMEM;
		return PTR_ERR(trans);
	}

	dir_id = btrfs_super_root_dir(&root->fs_info->super_copy);
@@ -2337,6 +2341,8 @@ static noinline long btrfs_ioctl_start_sync(struct file *file, void __user *argp
	u64 transid;

	trans = btrfs_start_transaction(root, 0);
	if (IS_ERR(trans))
		return PTR_ERR(trans);
	transid = trans->transid;
	btrfs_commit_transaction_async(trans, root, 0);

+3 −0
Original line number Diff line number Diff line
@@ -2028,6 +2028,7 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc,

	while (1) {
		trans = btrfs_start_transaction(root, 0);
		BUG_ON(IS_ERR(trans));
		trans->block_rsv = rc->block_rsv;

		ret = btrfs_block_rsv_check(trans, root, rc->block_rsv,
@@ -3665,6 +3666,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)

	while (1) {
		trans = btrfs_start_transaction(rc->extent_root, 0);
		BUG_ON(IS_ERR(trans));

		if (update_backref_cache(trans, &rc->backref_cache)) {
			btrfs_end_transaction(trans, rc->extent_root);
@@ -4033,6 +4035,7 @@ static noinline_for_stack int mark_garbage_root(struct btrfs_root *root)
	int ret;

	trans = btrfs_start_transaction(root->fs_info->tree_root, 0);
	BUG_ON(IS_ERR(trans));

	memset(&root->root_item.drop_progress, 0,
		sizeof(root->root_item.drop_progress));
+2 −0
Original line number Diff line number Diff line
@@ -623,6 +623,8 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
	btrfs_wait_ordered_extents(root, 0, 0);

	trans = btrfs_start_transaction(root, 0);
	if (IS_ERR(trans))
		return PTR_ERR(trans);
	ret = btrfs_commit_transaction(trans, root);
	return ret;
}
Loading