diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-01-16 11:44:43 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:59 -0400 |
commit | 2da98f003f4788b0a72c5f87bc55b061f65f30fa (patch) | |
tree | e94832937031f347168aaec4e50ab2ced8331ccb /fs/btrfs/ordered-data.c | |
parent | 9cce6c3bfca85bf92e8c9358542a18dfa6c232be (diff) |
Btrfs: Run igrab on data=ordered inodes to prevent deadlocks during writeout
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ordered-data.c')
-rw-r--r-- | fs/btrfs/ordered-data.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index b56011baa17c..cba2b623d02e 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
@@ -153,6 +153,8 @@ int btrfs_add_ordered_inode(struct inode *inode) | |||
153 | write_unlock(&tree->lock); | 153 | write_unlock(&tree->lock); |
154 | if (node) | 154 | if (node) |
155 | kfree(entry); | 155 | kfree(entry); |
156 | else | ||
157 | igrab(inode); | ||
156 | return 0; | 158 | return 0; |
157 | } | 159 | } |
158 | 160 | ||
@@ -221,6 +223,7 @@ int btrfs_find_del_first_ordered_inode(struct btrfs_ordered_inode_tree *tree, | |||
221 | } | 223 | } |
222 | 224 | ||
223 | static int __btrfs_del_ordered_inode(struct btrfs_ordered_inode_tree *tree, | 225 | static int __btrfs_del_ordered_inode(struct btrfs_ordered_inode_tree *tree, |
226 | struct inode *inode, | ||
224 | u64 root_objectid, u64 objectid) | 227 | u64 root_objectid, u64 objectid) |
225 | { | 228 | { |
226 | struct tree_entry *entry; | 229 | struct tree_entry *entry; |
@@ -234,6 +237,7 @@ static int __btrfs_del_ordered_inode(struct btrfs_ordered_inode_tree *tree, | |||
234 | return 0; | 237 | return 0; |
235 | } | 238 | } |
236 | rb_erase(node, &tree->tree); | 239 | rb_erase(node, &tree->tree); |
240 | BTRFS_I(inode)->ordered_trans = 0; | ||
237 | write_unlock(&tree->lock); | 241 | write_unlock(&tree->lock); |
238 | entry = rb_entry(node, struct tree_entry, rb_node); | 242 | entry = rb_entry(node, struct tree_entry, rb_node); |
239 | kfree(entry); | 243 | kfree(entry); |
@@ -244,14 +248,16 @@ int btrfs_del_ordered_inode(struct inode *inode) | |||
244 | { | 248 | { |
245 | struct btrfs_root *root = BTRFS_I(inode)->root; | 249 | struct btrfs_root *root = BTRFS_I(inode)->root; |
246 | u64 root_objectid = root->root_key.objectid; | 250 | u64 root_objectid = root->root_key.objectid; |
251 | int ret = 0; | ||
247 | 252 | ||
248 | spin_lock(&root->fs_info->new_trans_lock); | 253 | spin_lock(&root->fs_info->new_trans_lock); |
249 | if (root->fs_info->running_transaction) { | 254 | if (root->fs_info->running_transaction) { |
250 | struct btrfs_ordered_inode_tree *tree; | 255 | struct btrfs_ordered_inode_tree *tree; |
251 | tree = &root->fs_info->running_transaction->ordered_inode_tree; | 256 | tree = &root->fs_info->running_transaction->ordered_inode_tree; |
252 | __btrfs_del_ordered_inode(tree, root_objectid, inode->i_ino); | 257 | ret = __btrfs_del_ordered_inode(tree, inode, root_objectid, |
258 | inode->i_ino); | ||
253 | } | 259 | } |
254 | spin_unlock(&root->fs_info->new_trans_lock); | 260 | spin_unlock(&root->fs_info->new_trans_lock); |
255 | return 0; | 261 | return ret; |
256 | } | 262 | } |
257 | 263 | ||