Commit e038dca8 authored by Chris Mason's avatar Chris Mason

Merge branch 'for-chris' of...

Merge branch 'for-chris' of git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-work into for-linus

Conflicts:
	fs/btrfs/transaction.c
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parents 7585717f ed0ca140
...@@ -3076,6 +3076,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, ...@@ -3076,6 +3076,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
ret = btrfs_update_inode(trans, root, dir); ret = btrfs_update_inode(trans, root, dir);
BUG_ON(ret); BUG_ON(ret);
btrfs_free_path(path);
return 0; return 0;
} }
......
...@@ -482,8 +482,10 @@ static int create_snapshot(struct btrfs_root *root, struct dentry *dentry, ...@@ -482,8 +482,10 @@ static int create_snapshot(struct btrfs_root *root, struct dentry *dentry,
ret = btrfs_snap_reserve_metadata(trans, pending_snapshot); ret = btrfs_snap_reserve_metadata(trans, pending_snapshot);
BUG_ON(ret); BUG_ON(ret);
spin_lock(&root->fs_info->trans_lock);
list_add(&pending_snapshot->list, list_add(&pending_snapshot->list,
&trans->transaction->pending_snapshots); &trans->transaction->pending_snapshots);
spin_unlock(&root->fs_info->trans_lock);
if (async_transid) { if (async_transid) {
*async_transid = trans->transid; *async_transid = trans->transid;
ret = btrfs_commit_transaction_async(trans, ret = btrfs_commit_transaction_async(trans,
......
...@@ -1298,12 +1298,20 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, ...@@ -1298,12 +1298,20 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
schedule_timeout(1); schedule_timeout(1);
finish_wait(&cur_trans->writer_wait, &wait); finish_wait(&cur_trans->writer_wait, &wait);
spin_lock(&root->fs_info->trans_lock);
root->fs_info->trans_no_join = 1;
spin_unlock(&root->fs_info->trans_lock);
} while (atomic_read(&cur_trans->num_writers) > 1 || } while (atomic_read(&cur_trans->num_writers) > 1 ||
(should_grow && cur_trans->num_joined != joined)); (should_grow && cur_trans->num_joined != joined));
/*
* Ok now we need to make sure to block out any other joins while we
* commit the transaction. We could have started a join before setting
* no_join so make sure to wait for num_writers to == 1 again.
*/
spin_lock(&root->fs_info->trans_lock);
root->fs_info->trans_no_join = 1;
spin_unlock(&root->fs_info->trans_lock);
wait_event(cur_trans->writer_wait,
atomic_read(&cur_trans->num_writers) == 1);
/* /*
* the reloc mutex makes sure that we stop * the reloc mutex makes sure that we stop
* the balancing code from coming in and moving * the balancing code from coming in and moving
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment