Unverified Commit 6adee009 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!4847 btrfs: mainline backport

Merge Pull Request from: @ci-robot 
 
PR sync from: Yifan Qiao <qiaoyifan4@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/QCKFE6NBKTNELHGMHFSCSUAWYPZHSD3S/ 
Filipe Manana (2):
  btrfs: do not start and wait for delalloc on snapshot roots on
    transaction commit
  btrfs: fix deadlock when cloning inline extents and using qgroups


-- 
2.39.2
 
https://gitee.com/src-openeuler/kernel/issues/I94K22 
 
Link:https://gitee.com/openeuler/kernel/pulls/4847

 

Reviewed-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 7d417511 099a1955
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3008,7 +3008,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
			       struct inode *inode, u64 new_size,
			       u32 min_type);

int btrfs_start_delalloc_snapshot(struct btrfs_root *root);
int btrfs_start_delalloc_snapshot(struct btrfs_root *root, bool in_reclaim_context);
int btrfs_start_delalloc_roots(struct btrfs_fs_info *fs_info, u64 nr,
			       bool in_reclaim_context);
int btrfs_set_extent_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
+2 −2
Original line number Diff line number Diff line
@@ -9526,7 +9526,7 @@ static int start_delalloc_inodes(struct btrfs_root *root,
	return ret;
}

int btrfs_start_delalloc_snapshot(struct btrfs_root *root)
int btrfs_start_delalloc_snapshot(struct btrfs_root *root, bool in_reclaim_context)
{
	struct writeback_control wbc = {
		.nr_to_write = LONG_MAX,
@@ -9539,7 +9539,7 @@ int btrfs_start_delalloc_snapshot(struct btrfs_root *root)
	if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state))
		return -EROFS;

	return start_delalloc_inodes(root, &wbc, true, false);
	return start_delalloc_inodes(root, &wbc, true, in_reclaim_context);
}

int btrfs_start_delalloc_roots(struct btrfs_fs_info *fs_info, u64 nr,
+1 −1
Original line number Diff line number Diff line
@@ -1030,7 +1030,7 @@ static noinline int btrfs_mksnapshot(const struct path *parent,
	 */
	btrfs_drew_read_lock(&root->snapshot_lock);

	ret = btrfs_start_delalloc_snapshot(root);
	ret = btrfs_start_delalloc_snapshot(root, false);
	if (ret)
		goto out;

+1 −1
Original line number Diff line number Diff line
@@ -3695,7 +3695,7 @@ static int try_flush_qgroup(struct btrfs_root *root)
		return 0;
	}

	ret = btrfs_start_delalloc_snapshot(root);
	ret = btrfs_start_delalloc_snapshot(root, true);
	if (ret < 0)
		goto out;
	btrfs_wait_ordered_extents(root, U64_MAX, 0, (u64)-1);
+2 −2
Original line number Diff line number Diff line
@@ -7196,7 +7196,7 @@ static int flush_delalloc_roots(struct send_ctx *sctx)
	int i;

	if (root) {
		ret = btrfs_start_delalloc_snapshot(root);
		ret = btrfs_start_delalloc_snapshot(root, false);
		if (ret)
			return ret;
		btrfs_wait_ordered_extents(root, U64_MAX, 0, U64_MAX);
@@ -7204,7 +7204,7 @@ static int flush_delalloc_roots(struct send_ctx *sctx)

	for (i = 0; i < sctx->clone_roots_cnt; i++) {
		root = sctx->clone_roots[i].root;
		ret = btrfs_start_delalloc_snapshot(root);
		ret = btrfs_start_delalloc_snapshot(root, false);
		if (ret)
			return ret;
		btrfs_wait_ordered_extents(root, U64_MAX, 0, U64_MAX);
Loading