aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/tree-log.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 8a03b39648be..ca960ad271fe 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -139,7 +139,6 @@ static int start_log_trans(struct btrfs_trans_handle *trans,
139 struct btrfs_root *root) 139 struct btrfs_root *root)
140{ 140{
141 int ret; 141 int ret;
142 int err = 0;
143 142
144 mutex_lock(&root->log_mutex); 143 mutex_lock(&root->log_mutex);
145 if (root->log_root) { 144 if (root->log_root) {
@@ -155,24 +154,27 @@ static int start_log_trans(struct btrfs_trans_handle *trans,
155 mutex_unlock(&root->log_mutex); 154 mutex_unlock(&root->log_mutex);
156 return 0; 155 return 0;
157 } 156 }
158 root->log_multiple_pids = false; 157
159 root->log_start_pid = current->pid; 158 ret = 0;
160 mutex_lock(&root->fs_info->tree_log_mutex); 159 mutex_lock(&root->fs_info->tree_log_mutex);
161 if (!root->fs_info->log_root_tree) { 160 if (!root->fs_info->log_root_tree)
162 ret = btrfs_init_log_root_tree(trans, root->fs_info); 161 ret = btrfs_init_log_root_tree(trans, root->fs_info);
163 if (ret) 162 mutex_unlock(&root->fs_info->tree_log_mutex);
164 err = ret; 163 if (ret)
165 } 164 goto out;
166 if (err == 0 && !root->log_root) { 165
166 if (!root->log_root) {
167 ret = btrfs_add_log_tree(trans, root); 167 ret = btrfs_add_log_tree(trans, root);
168 if (ret) 168 if (ret)
169 err = ret; 169 goto out;
170 } 170 }
171 mutex_unlock(&root->fs_info->tree_log_mutex); 171 root->log_multiple_pids = false;
172 root->log_start_pid = current->pid;
172 atomic_inc(&root->log_batch); 173 atomic_inc(&root->log_batch);
173 atomic_inc(&root->log_writers); 174 atomic_inc(&root->log_writers);
175out:
174 mutex_unlock(&root->log_mutex); 176 mutex_unlock(&root->log_mutex);
175 return err; 177 return ret;
176} 178}
177 179
178/* 180/*
@@ -4116,7 +4118,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
4116 4118
4117 ret = start_log_trans(trans, root); 4119 ret = start_log_trans(trans, root);
4118 if (ret) 4120 if (ret)
4119 goto end_trans; 4121 goto end_no_trans;
4120 4122
4121 ret = btrfs_log_inode(trans, root, inode, inode_only); 4123 ret = btrfs_log_inode(trans, root, inode, inode_only);
4122 if (ret) 4124 if (ret)