aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ordered-data.c
diff options
context:
space:
mode:
authorYan, Zheng <zheng.yan@oracle.com>2009-11-12 04:36:34 -0500
committerChris Mason <chris.mason@oracle.com>2009-12-17 12:33:35 -0500
commit24bbcf0442ee04660a5a030efdbb6d03f1c275cb (patch)
treeaa57d77d29cc5150b272cc3f6465f10262fcbaac /fs/btrfs/ordered-data.c
parentf34f57a3ab4e73304d78c125682f1a53cd3975f2 (diff)
Btrfs: Add delayed iput
iput() can trigger new transactions if we are dropping the final reference, so calling it in btrfs_commit_transaction may end up deadlock. This patch adds delayed iput to avoid the issue. Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ordered-data.c')
-rw-r--r--fs/btrfs/ordered-data.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index 9b16073bb875..b10a49d4bc6a 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -352,7 +352,8 @@ int btrfs_remove_ordered_extent(struct inode *inode,
352 * wait for all the ordered extents in a root. This is done when balancing 352 * wait for all the ordered extents in a root. This is done when balancing
353 * space between drives. 353 * space between drives.
354 */ 354 */
355int btrfs_wait_ordered_extents(struct btrfs_root *root, int nocow_only) 355int btrfs_wait_ordered_extents(struct btrfs_root *root,
356 int nocow_only, int delay_iput)
356{ 357{
357 struct list_head splice; 358 struct list_head splice;
358 struct list_head *cur; 359 struct list_head *cur;
@@ -389,7 +390,10 @@ int btrfs_wait_ordered_extents(struct btrfs_root *root, int nocow_only)
389 if (inode) { 390 if (inode) {
390 btrfs_start_ordered_extent(inode, ordered, 1); 391 btrfs_start_ordered_extent(inode, ordered, 1);
391 btrfs_put_ordered_extent(ordered); 392 btrfs_put_ordered_extent(ordered);
392 iput(inode); 393 if (delay_iput)
394 btrfs_add_delayed_iput(inode);
395 else
396 iput(inode);
393 } else { 397 } else {
394 btrfs_put_ordered_extent(ordered); 398 btrfs_put_ordered_extent(ordered);
395 } 399 }
@@ -447,7 +451,7 @@ again:
447 btrfs_wait_ordered_range(inode, 0, (u64)-1); 451 btrfs_wait_ordered_range(inode, 0, (u64)-1);
448 else 452 else
449 filemap_flush(inode->i_mapping); 453 filemap_flush(inode->i_mapping);
450 iput(inode); 454 btrfs_add_delayed_iput(inode);
451 } 455 }
452 456
453 cond_resched(); 457 cond_resched();