diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-01-14 16:24:38 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:59 -0400 |
commit | 61295eb8665e723e77af91d0a1e655a4bd28344f (patch) | |
tree | 15e1f88cfa9faaaef85f9afd49f8860c069095a2 /fs | |
parent | 8c416c9e0d35b0462e89b76b7581127efe03b8b2 (diff) |
Btrfs: Add drop inode func to avoid data=ordered deadlock
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/ctree.h | 1 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 19 | ||||
-rw-r--r-- | fs/btrfs/super.c | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index f65b258344d4..a2c2d6d82c5e 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1144,6 +1144,7 @@ int btrfs_check_free_space(struct btrfs_root *root, u64 num_required, | |||
1144 | int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page); | 1144 | int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page); |
1145 | int btrfs_readpage(struct file *file, struct page *page); | 1145 | int btrfs_readpage(struct file *file, struct page *page); |
1146 | void btrfs_delete_inode(struct inode *inode); | 1146 | void btrfs_delete_inode(struct inode *inode); |
1147 | void btrfs_drop_inode(struct inode *inode); | ||
1147 | void btrfs_read_locked_inode(struct inode *inode); | 1148 | void btrfs_read_locked_inode(struct inode *inode); |
1148 | int btrfs_write_inode(struct inode *inode, int wait); | 1149 | int btrfs_write_inode(struct inode *inode, int wait); |
1149 | void btrfs_dirty_inode(struct inode *inode); | 1150 | void btrfs_dirty_inode(struct inode *inode); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5260b4708158..e53d20331646 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -990,6 +990,25 @@ out: | |||
990 | fail: | 990 | fail: |
991 | return err; | 991 | return err; |
992 | } | 992 | } |
993 | |||
994 | void btrfs_drop_inode(struct inode *inode) | ||
995 | { | ||
996 | struct btrfs_trans_handle *trans; | ||
997 | struct btrfs_root *root = BTRFS_I(inode)->root; | ||
998 | |||
999 | if (!BTRFS_I(inode)->ordered_trans) { | ||
1000 | generic_drop_inode(inode); | ||
1001 | return; | ||
1002 | } | ||
1003 | /* nasty, but it prevents a deadlock with data=ordered by preventing | ||
1004 | * a commit until after this inode is done | ||
1005 | */ | ||
1006 | trans = btrfs_start_transaction(root, 1); | ||
1007 | generic_drop_inode(inode); | ||
1008 | /* note, the inode is now untouchable */ | ||
1009 | btrfs_end_transaction(trans, root); | ||
1010 | } | ||
1011 | |||
993 | void btrfs_delete_inode(struct inode *inode) | 1012 | void btrfs_delete_inode(struct inode *inode) |
994 | { | 1013 | { |
995 | struct btrfs_trans_handle *trans; | 1014 | struct btrfs_trans_handle *trans; |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 9ab4086d463c..4deea393ca94 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -425,6 +425,7 @@ static struct file_system_type btrfs_fs_type = { | |||
425 | 425 | ||
426 | static struct super_operations btrfs_super_ops = { | 426 | static struct super_operations btrfs_super_ops = { |
427 | .delete_inode = btrfs_delete_inode, | 427 | .delete_inode = btrfs_delete_inode, |
428 | .drop_inode = btrfs_drop_inode, | ||
428 | .put_super = btrfs_put_super, | 429 | .put_super = btrfs_put_super, |
429 | .read_inode = btrfs_read_locked_inode, | 430 | .read_inode = btrfs_read_locked_inode, |
430 | .write_super = btrfs_write_super, | 431 | .write_super = btrfs_write_super, |