diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 1843aa3a4b5615..2a66ad9cdab01f 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -2690,6 +2690,9 @@ int btrfs_start_dirty_block_groups(struct btrfs_trans_handle *trans) } spin_unlock(&cur_trans->dirty_bgs_lock); } else if (ret < 0) { + spin_lock(&cur_trans->dirty_bgs_lock); + list_splice_init(&dirty, &cur_trans->dirty_bgs); + spin_unlock(&cur_trans->dirty_bgs_lock); btrfs_cleanup_dirty_bgs(cur_trans, fs_info); }